| 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 <map> | 5 #include <map> |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/extensions/extension_system.h" | 9 #include "chrome/browser/extensions/extension_system.h" |
| 10 #include "chrome/browser/extensions/extension_test_message_listener.h" | 10 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 protected: | 79 protected: |
| 80 void LoadNamedExtension(const FilePath& path, | 80 void LoadNamedExtension(const FilePath& path, |
| 81 const std::string& name) { | 81 const std::string& name) { |
| 82 const Extension* extension = LoadExtension(path.AppendASCII(name)); | 82 const Extension* extension = LoadExtension(path.AppendASCII(name)); |
| 83 ASSERT_TRUE(extension); | 83 ASSERT_TRUE(extension); |
| 84 extension_ids_[name] = extension->id(); | 84 extension_ids_[name] = extension->id(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void InstallNamedExtension(const FilePath& path, | 87 void InstallNamedExtension(const FilePath& path, |
| 88 const std::string& name, | 88 const std::string& name, |
| 89 Extension::Location install_source) { | 89 Manifest::Location install_source) { |
| 90 const Extension* extension = InstallExtension(path.AppendASCII(name), 1, | 90 const Extension* extension = InstallExtension(path.AppendASCII(name), 1, |
| 91 install_source); | 91 install_source); |
| 92 ASSERT_TRUE(extension); | 92 ASSERT_TRUE(extension); |
| 93 extension_ids_[name] = extension->id(); | 93 extension_ids_[name] = extension->id(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 // Maps installed extension names to their IDs. | 96 // Maps installed extension names to their IDs. |
| 97 std::map<std::string, std::string> extension_ids_; | 97 std::map<std::string, std::string> extension_ids_; |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, Basics) { | 100 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, Basics) { |
| 101 LoadExtensions(); | 101 LoadExtensions(); |
| 102 | 102 |
| 103 FilePath basedir = test_data_dir_.AppendASCII("management"); | 103 FilePath basedir = test_data_dir_.AppendASCII("management"); |
| 104 InstallNamedExtension(basedir, "internal_extension", Extension::INTERNAL); | 104 InstallNamedExtension(basedir, "internal_extension", Manifest::INTERNAL); |
| 105 InstallNamedExtension(basedir, "external_extension", | 105 InstallNamedExtension(basedir, "external_extension", |
| 106 Extension::EXTERNAL_PREF); | 106 Manifest::EXTERNAL_PREF); |
| 107 InstallNamedExtension(basedir, "admin_extension", | 107 InstallNamedExtension(basedir, "admin_extension", |
| 108 Extension::EXTERNAL_POLICY_DOWNLOAD); | 108 Manifest::EXTERNAL_POLICY_DOWNLOAD); |
| 109 | 109 |
| 110 ASSERT_TRUE(RunExtensionSubtest("management/test", "basics.html")); | 110 ASSERT_TRUE(RunExtensionSubtest("management/test", "basics.html")); |
| 111 } | 111 } |
| 112 | 112 |
| 113 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, Uninstall) { | 113 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, Uninstall) { |
| 114 LoadExtensions(); | 114 LoadExtensions(); |
| 115 ASSERT_TRUE(RunExtensionSubtest("management/test", "uninstall.html")); | 115 ASSERT_TRUE(RunExtensionSubtest("management/test", "uninstall.html")); |
| 116 } | 116 } |
| 117 | 117 |
| 118 // Tests actions on extensions when no management policy is in place. | 118 // Tests actions on extensions when no management policy is in place. |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 ASSERT_EQ(2, browser()->tab_strip_model()->count()); | 257 ASSERT_EQ(2, browser()->tab_strip_model()->count()); |
| 258 #else | 258 #else |
| 259 // Find the app's browser. Opening in a new window will create | 259 // Find the app's browser. Opening in a new window will create |
| 260 // a new browser. | 260 // a new browser. |
| 261 ASSERT_EQ(2u, chrome::GetBrowserCount(browser()->profile())); | 261 ASSERT_EQ(2u, chrome::GetBrowserCount(browser()->profile())); |
| 262 Browser* app_browser = FindOtherBrowser(browser()); | 262 Browser* app_browser = FindOtherBrowser(browser()); |
| 263 ASSERT_TRUE(app_browser->is_app()); | 263 ASSERT_TRUE(app_browser->is_app()); |
| 264 ASSERT_FALSE(app_browser->is_type_panel()); | 264 ASSERT_FALSE(app_browser->is_type_panel()); |
| 265 #endif | 265 #endif |
| 266 } | 266 } |
| OLD | NEW |