| OLD | NEW | 
|    1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |    1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
|    2 // Use of this source code is governed by a BSD-style license that can be |    2 // Use of this source code is governed by a BSD-style license that can be | 
|    3 // found in the LICENSE file. |    3 // found in the LICENSE file. | 
|    4  |    4  | 
|    5 #include "base/command_line.h" |    5 #include "base/command_line.h" | 
|    6 #include "base/json/json_file_value_serializer.h" |    6 #include "base/json/json_file_value_serializer.h" | 
|    7 #include "base/message_loop.h" |    7 #include "base/message_loop.h" | 
|    8 #include "base/path_service.h" |    8 #include "base/path_service.h" | 
|    9 #include "base/string_util.h" |    9 #include "base/string_util.h" | 
|   10 #include "chrome/browser/extensions/extension_service.h" |   10 #include "chrome/browser/extensions/extension_service.h" | 
|   11 #include "chrome/browser/extensions/management_policy.h" |   11 #include "chrome/browser/extensions/management_policy.h" | 
|   12 #include "chrome/browser/extensions/test_extension_system.h" |   12 #include "chrome/browser/extensions/test_extension_system.h" | 
|   13 #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h" |   13 #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h" | 
|   14 #include "chrome/common/chrome_paths.h" |   14 #include "chrome/common/chrome_paths.h" | 
|   15 #include "chrome/common/extensions/extension.h" |   15 #include "chrome/common/extensions/extension.h" | 
|   16 #include "chrome/test/base/testing_profile.h" |   16 #include "chrome/test/base/testing_profile.h" | 
|   17 #include "content/public/test/test_browser_thread.h" |   17 #include "content/public/test/test_browser_thread.h" | 
 |   18 #include "extensions/common/constants.h" | 
|   18 #include "testing/gtest/include/gtest/gtest.h" |   19 #include "testing/gtest/include/gtest/gtest.h" | 
|   19  |   20  | 
|   20 using extensions::Extension; |   21 using extensions::Extension; | 
|   21 using extensions::Manifest; |   22 using extensions::Manifest; | 
|   22  |   23  | 
|   23 class ExtensionUITest : public testing::Test { |   24 class ExtensionUITest : public testing::Test { | 
|   24  public: |   25  public: | 
|   25   ExtensionUITest() |   26   ExtensionUITest() | 
|   26       : ui_thread_(content::BrowserThread::UI, &message_loop_), |   27       : ui_thread_(content::BrowserThread::UI, &message_loop_), | 
|   27         file_thread_(content::BrowserThread::FILE, &message_loop_) {} |   28         file_thread_(content::BrowserThread::FILE, &message_loop_) {} | 
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   59     return static_cast<DictionaryValue*>(value); |   60     return static_cast<DictionaryValue*>(value); | 
|   60   } |   61   } | 
|   61  |   62  | 
|   62   DictionaryValue* CreateExtensionDetailViewFromPath( |   63   DictionaryValue* CreateExtensionDetailViewFromPath( | 
|   63       const base::FilePath& extension_path, |   64       const base::FilePath& extension_path, | 
|   64       const std::vector<ExtensionPage>& pages, |   65       const std::vector<ExtensionPage>& pages, | 
|   65       Manifest::Location location) { |   66       Manifest::Location location) { | 
|   66     std::string error; |   67     std::string error; | 
|   67  |   68  | 
|   68     base::FilePath manifest_path = extension_path.Append( |   69     base::FilePath manifest_path = extension_path.Append( | 
|   69         Extension::kManifestFilename); |   70         extensions::kManifestFilename); | 
|   70     scoped_ptr<DictionaryValue> extension_data(DeserializeJSONTestData( |   71     scoped_ptr<DictionaryValue> extension_data(DeserializeJSONTestData( | 
|   71         manifest_path, &error)); |   72         manifest_path, &error)); | 
|   72     EXPECT_EQ("", error); |   73     EXPECT_EQ("", error); | 
|   73  |   74  | 
|   74     scoped_refptr<Extension> extension(Extension::Create( |   75     scoped_refptr<Extension> extension(Extension::Create( | 
|   75         extension_path, location, *extension_data, Extension::REQUIRE_KEY, |   76         extension_path, location, *extension_data, Extension::REQUIRE_KEY, | 
|   76         &error)); |   77         &error)); | 
|   77     EXPECT_TRUE(extension.get()); |   78     EXPECT_TRUE(extension.get()); | 
|   78     EXPECT_EQ("", error); |   79     EXPECT_EQ("", error); | 
|   79  |   80  | 
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  259  |  260  | 
|  260   scoped_ptr<DictionaryValue> extension_details( |  261   scoped_ptr<DictionaryValue> extension_details( | 
|  261       CreateExtensionDetailViewFromPath( |  262       CreateExtensionDetailViewFromPath( | 
|  262           extension_path, pages, Manifest::UNPACKED)); |  263           extension_path, pages, Manifest::UNPACKED)); | 
|  263  |  264  | 
|  264   base::FilePath::StringType ui_path; |  265   base::FilePath::StringType ui_path; | 
|  265  |  266  | 
|  266   EXPECT_TRUE(extension_details->GetString("path", &ui_path)); |  267   EXPECT_TRUE(extension_details->GetString("path", &ui_path)); | 
|  267   EXPECT_EQ(extension_path, base::FilePath(ui_path)); |  268   EXPECT_EQ(extension_path, base::FilePath(ui_path)); | 
|  268 } |  269 } | 
| OLD | NEW |