| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/ref_counted.h" | 5 #include "base/ref_counted.h" |
| 6 #include "chrome/browser/extensions/autoupdate_interceptor.h" | 6 #include "chrome/browser/extensions/autoupdate_interceptor.h" |
| 7 #include "chrome/browser/extensions/extension_browsertest.h" | 7 #include "chrome/browser/extensions/extension_browsertest.h" |
| 8 #include "chrome/browser/extensions/extension_host.h" | 8 #include "chrome/browser/extensions/extension_host.h" |
| 9 #include "chrome/browser/extensions/extensions_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/extension_test_message_listener.h" | 10 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 11 #include "chrome/browser/extensions/extension_updater.h" | 11 #include "chrome/browser/extensions/extension_updater.h" |
| 12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
| 13 #include "chrome/browser/prefs/scoped_pref_update.h" | 13 #include "chrome/browser/prefs/scoped_pref_update.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/renderer_host/render_view_host.h" | 15 #include "chrome/browser/renderer_host/render_view_host.h" |
| 16 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 18 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
| 19 #include "chrome/test/ui_test_utils.h" | 19 #include "chrome/test/ui_test_utils.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 50 if (version_from_bg != expected_version || | 50 if (version_from_bg != expected_version || |
| 51 extension->VersionString() != expected_version) | 51 extension->VersionString() != expected_version) |
| 52 return false; | 52 return false; |
| 53 return true; | 53 return true; |
| 54 } | 54 } |
| 55 | 55 |
| 56 // Helper method that installs a low permission extension then updates | 56 // Helper method that installs a low permission extension then updates |
| 57 // to the second version requiring increased permissions. Returns whether | 57 // to the second version requiring increased permissions. Returns whether |
| 58 // the operation was completed successfully. | 58 // the operation was completed successfully. |
| 59 bool InstallAndUpdateIncreasingPermissionsExtension() { | 59 bool InstallAndUpdateIncreasingPermissionsExtension() { |
| 60 ExtensionsService* service = browser()->profile()->GetExtensionsService(); | 60 ExtensionService* service = browser()->profile()->GetExtensionService(); |
| 61 size_t size_before = service->extensions()->size(); | 61 size_t size_before = service->extensions()->size(); |
| 62 | 62 |
| 63 // Install the initial version, which should happen just fine. | 63 // Install the initial version, which should happen just fine. |
| 64 if (!InstallExtension( | 64 if (!InstallExtension( |
| 65 test_data_dir_.AppendASCII("permissions-low-v1.crx"), 1)) | 65 test_data_dir_.AppendASCII("permissions-low-v1.crx"), 1)) |
| 66 return false; | 66 return false; |
| 67 | 67 |
| 68 // Upgrade to a version that wants more permissions. We should disable the | 68 // Upgrade to a version that wants more permissions. We should disable the |
| 69 // extension and prompt the user to reenable. | 69 // extension and prompt the user to reenable. |
| 70 if (service->extensions()->size() != size_before + 1) | 70 if (service->extensions()->size() != size_before + 1) |
| 71 return false; | 71 return false; |
| 72 if (!UpdateExtension( | 72 if (!UpdateExtension( |
| 73 service->extensions()->at(size_before)->id(), | 73 service->extensions()->at(size_before)->id(), |
| 74 test_data_dir_.AppendASCII("permissions-high-v2.crx"), -1)) | 74 test_data_dir_.AppendASCII("permissions-high-v2.crx"), -1)) |
| 75 return false; | 75 return false; |
| 76 EXPECT_EQ(size_before, service->extensions()->size()); | 76 EXPECT_EQ(size_before, service->extensions()->size()); |
| 77 if (service->disabled_extensions()->size() != 1u) | 77 if (service->disabled_extensions()->size() != 1u) |
| 78 return false; | 78 return false; |
| 79 return true; | 79 return true; |
| 80 } | 80 } |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 // Tests that installing the same version overwrites. | 83 // Tests that installing the same version overwrites. |
| 84 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, InstallSameVersion) { | 84 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, InstallSameVersion) { |
| 85 ExtensionsService* service = browser()->profile()->GetExtensionsService(); | 85 ExtensionService* service = browser()->profile()->GetExtensionService(); |
| 86 const size_t size_before = service->extensions()->size(); | 86 const size_t size_before = service->extensions()->size(); |
| 87 ASSERT_TRUE(InstallExtension( | 87 ASSERT_TRUE(InstallExtension( |
| 88 test_data_dir_.AppendASCII("install/install.crx"), 1)); | 88 test_data_dir_.AppendASCII("install/install.crx"), 1)); |
| 89 FilePath old_path = service->extensions()->back()->path(); | 89 FilePath old_path = service->extensions()->back()->path(); |
| 90 | 90 |
| 91 // Install an extension with the same version. The previous install should be | 91 // Install an extension with the same version. The previous install should be |
| 92 // overwritten. | 92 // overwritten. |
| 93 ASSERT_TRUE(InstallExtension( | 93 ASSERT_TRUE(InstallExtension( |
| 94 test_data_dir_.AppendASCII("install/install_same_version.crx"), 0)); | 94 test_data_dir_.AppendASCII("install/install_same_version.crx"), 0)); |
| 95 FilePath new_path = service->extensions()->back()->path(); | 95 FilePath new_path = service->extensions()->back()->path(); |
| 96 | 96 |
| 97 EXPECT_FALSE(IsExtensionAtVersion(service->extensions()->at(size_before), | 97 EXPECT_FALSE(IsExtensionAtVersion(service->extensions()->at(size_before), |
| 98 "1.0")); | 98 "1.0")); |
| 99 EXPECT_NE(old_path.value(), new_path.value()); | 99 EXPECT_NE(old_path.value(), new_path.value()); |
| 100 } | 100 } |
| 101 | 101 |
| 102 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, InstallOlderVersion) { | 102 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, InstallOlderVersion) { |
| 103 ExtensionsService* service = browser()->profile()->GetExtensionsService(); | 103 ExtensionService* service = browser()->profile()->GetExtensionService(); |
| 104 const size_t size_before = service->extensions()->size(); | 104 const size_t size_before = service->extensions()->size(); |
| 105 ASSERT_TRUE(InstallExtension( | 105 ASSERT_TRUE(InstallExtension( |
| 106 test_data_dir_.AppendASCII("install/install.crx"), 1)); | 106 test_data_dir_.AppendASCII("install/install.crx"), 1)); |
| 107 ASSERT_TRUE(InstallExtension( | 107 ASSERT_TRUE(InstallExtension( |
| 108 test_data_dir_.AppendASCII("install/install_older_version.crx"), 0)); | 108 test_data_dir_.AppendASCII("install/install_older_version.crx"), 0)); |
| 109 EXPECT_TRUE(IsExtensionAtVersion(service->extensions()->at(size_before), | 109 EXPECT_TRUE(IsExtensionAtVersion(service->extensions()->at(size_before), |
| 110 "1.0")); | 110 "1.0")); |
| 111 } | 111 } |
| 112 | 112 |
| 113 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, InstallThenCancel) { | 113 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, InstallThenCancel) { |
| 114 ExtensionsService* service = browser()->profile()->GetExtensionsService(); | 114 ExtensionService* service = browser()->profile()->GetExtensionService(); |
| 115 const size_t size_before = service->extensions()->size(); | 115 const size_t size_before = service->extensions()->size(); |
| 116 ASSERT_TRUE(InstallExtension( | 116 ASSERT_TRUE(InstallExtension( |
| 117 test_data_dir_.AppendASCII("install/install.crx"), 1)); | 117 test_data_dir_.AppendASCII("install/install.crx"), 1)); |
| 118 | 118 |
| 119 // Cancel this install. | 119 // Cancel this install. |
| 120 StartInstallButCancel(test_data_dir_.AppendASCII("install/install_v2.crx")); | 120 StartInstallButCancel(test_data_dir_.AppendASCII("install/install_v2.crx")); |
| 121 EXPECT_TRUE(IsExtensionAtVersion(service->extensions()->at(size_before), | 121 EXPECT_TRUE(IsExtensionAtVersion(service->extensions()->at(size_before), |
| 122 "1.0")); | 122 "1.0")); |
| 123 } | 123 } |
| 124 | 124 |
| 125 // Tests that installing and uninstalling extensions don't crash with an | 125 // Tests that installing and uninstalling extensions don't crash with an |
| 126 // incognito window open. | 126 // incognito window open. |
| 127 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, Incognito) { | 127 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, Incognito) { |
| 128 // Open an incognito window to the extensions management page. We just | 128 // Open an incognito window to the extensions management page. We just |
| 129 // want to make sure that we don't crash while playing with extensions when | 129 // want to make sure that we don't crash while playing with extensions when |
| 130 // this guy is around. | 130 // this guy is around. |
| 131 ui_test_utils::OpenURLOffTheRecord(browser()->profile(), | 131 ui_test_utils::OpenURLOffTheRecord(browser()->profile(), |
| 132 GURL(chrome::kChromeUIExtensionsURL)); | 132 GURL(chrome::kChromeUIExtensionsURL)); |
| 133 | 133 |
| 134 ASSERT_TRUE(InstallExtension(test_data_dir_.AppendASCII("good.crx"), 1)); | 134 ASSERT_TRUE(InstallExtension(test_data_dir_.AppendASCII("good.crx"), 1)); |
| 135 UninstallExtension("ldnnhddmnhbkjipkidpdiheffobcpfmf"); | 135 UninstallExtension("ldnnhddmnhbkjipkidpdiheffobcpfmf"); |
| 136 } | 136 } |
| 137 | 137 |
| 138 // Tests the process of updating an extension to one that requires higher | 138 // Tests the process of updating an extension to one that requires higher |
| 139 // permissions. | 139 // permissions. |
| 140 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, UpdatePermissions) { | 140 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, UpdatePermissions) { |
| 141 ExtensionsService* service = browser()->profile()->GetExtensionsService(); | 141 ExtensionService* service = browser()->profile()->GetExtensionService(); |
| 142 ASSERT_TRUE(InstallAndUpdateIncreasingPermissionsExtension()); | 142 ASSERT_TRUE(InstallAndUpdateIncreasingPermissionsExtension()); |
| 143 const size_t size_before = service->extensions()->size(); | 143 const size_t size_before = service->extensions()->size(); |
| 144 | 144 |
| 145 // Now try reenabling it. | 145 // Now try reenabling it. |
| 146 service->EnableExtension(service->disabled_extensions()->at(0)->id()); | 146 service->EnableExtension(service->disabled_extensions()->at(0)->id()); |
| 147 EXPECT_EQ(size_before + 1, service->extensions()->size()); | 147 EXPECT_EQ(size_before + 1, service->extensions()->size()); |
| 148 EXPECT_EQ(0u, service->disabled_extensions()->size()); | 148 EXPECT_EQ(0u, service->disabled_extensions()->size()); |
| 149 } | 149 } |
| 150 | 150 |
| 151 // Tests that we can uninstall a disabled extension. | 151 // Tests that we can uninstall a disabled extension. |
| 152 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, UninstallDisabled) { | 152 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, UninstallDisabled) { |
| 153 ExtensionsService* service = browser()->profile()->GetExtensionsService(); | 153 ExtensionService* service = browser()->profile()->GetExtensionService(); |
| 154 ASSERT_TRUE(InstallAndUpdateIncreasingPermissionsExtension()); | 154 ASSERT_TRUE(InstallAndUpdateIncreasingPermissionsExtension()); |
| 155 const size_t size_before = service->extensions()->size(); | 155 const size_t size_before = service->extensions()->size(); |
| 156 | 156 |
| 157 // Now try uninstalling it. | 157 // Now try uninstalling it. |
| 158 UninstallExtension(service->disabled_extensions()->at(0)->id()); | 158 UninstallExtension(service->disabled_extensions()->at(0)->id()); |
| 159 EXPECT_EQ(size_before, service->extensions()->size()); | 159 EXPECT_EQ(size_before, service->extensions()->size()); |
| 160 EXPECT_EQ(0u, service->disabled_extensions()->size()); | 160 EXPECT_EQ(0u, service->disabled_extensions()->size()); |
| 161 } | 161 } |
| 162 | 162 |
| 163 // Tests that disabling and re-enabling an extension works. | 163 // Tests that disabling and re-enabling an extension works. |
| 164 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, DisableEnable) { | 164 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, DisableEnable) { |
| 165 ExtensionProcessManager* manager = browser()->profile()-> | 165 ExtensionProcessManager* manager = browser()->profile()-> |
| 166 GetExtensionProcessManager(); | 166 GetExtensionProcessManager(); |
| 167 ExtensionsService* service = browser()->profile()->GetExtensionsService(); | 167 ExtensionService* service = browser()->profile()->GetExtensionService(); |
| 168 const size_t size_before = service->extensions()->size(); | 168 const size_t size_before = service->extensions()->size(); |
| 169 | 169 |
| 170 // Load an extension, expect the background page to be available. | 170 // Load an extension, expect the background page to be available. |
| 171 ASSERT_TRUE(LoadExtension( | 171 ASSERT_TRUE(LoadExtension( |
| 172 test_data_dir_.AppendASCII("good").AppendASCII("Extensions") | 172 test_data_dir_.AppendASCII("good").AppendASCII("Extensions") |
| 173 .AppendASCII("bjafgdebaacbbbecmhlhpofkepfkgcpa") | 173 .AppendASCII("bjafgdebaacbbbecmhlhpofkepfkgcpa") |
| 174 .AppendASCII("1.0"))); | 174 .AppendASCII("1.0"))); |
| 175 ASSERT_EQ(size_before + 1, service->extensions()->size()); | 175 ASSERT_EQ(size_before + 1, service->extensions()->size()); |
| 176 EXPECT_EQ(0u, service->disabled_extensions()->size()); | 176 EXPECT_EQ(0u, service->disabled_extensions()->size()); |
| 177 const Extension* extension = service->extensions()->at(size_before); | 177 const Extension* extension = service->extensions()->at(size_before); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 200 scoped_refptr<AutoUpdateInterceptor> interceptor(new AutoUpdateInterceptor()); | 200 scoped_refptr<AutoUpdateInterceptor> interceptor(new AutoUpdateInterceptor()); |
| 201 URLFetcher::enable_interception_for_tests(true); | 201 URLFetcher::enable_interception_for_tests(true); |
| 202 | 202 |
| 203 interceptor->SetResponseOnIOThread("http://localhost/autoupdate/manifest", | 203 interceptor->SetResponseOnIOThread("http://localhost/autoupdate/manifest", |
| 204 basedir.AppendASCII("manifest_v2.xml")); | 204 basedir.AppendASCII("manifest_v2.xml")); |
| 205 interceptor->SetResponseOnIOThread("http://localhost/autoupdate/v2.crx", | 205 interceptor->SetResponseOnIOThread("http://localhost/autoupdate/v2.crx", |
| 206 basedir.AppendASCII("v2.crx")); | 206 basedir.AppendASCII("v2.crx")); |
| 207 | 207 |
| 208 // Install version 1 of the extension. | 208 // Install version 1 of the extension. |
| 209 ExtensionTestMessageListener listener1("v1 installed", false); | 209 ExtensionTestMessageListener listener1("v1 installed", false); |
| 210 ExtensionsService* service = browser()->profile()->GetExtensionsService(); | 210 ExtensionService* service = browser()->profile()->GetExtensionService(); |
| 211 const size_t size_before = service->extensions()->size(); | 211 const size_t size_before = service->extensions()->size(); |
| 212 ASSERT_TRUE(service->disabled_extensions()->empty()); | 212 ASSERT_TRUE(service->disabled_extensions()->empty()); |
| 213 ASSERT_TRUE(InstallExtension(basedir.AppendASCII("v1.crx"), 1)); | 213 ASSERT_TRUE(InstallExtension(basedir.AppendASCII("v1.crx"), 1)); |
| 214 listener1.WaitUntilSatisfied(); | 214 listener1.WaitUntilSatisfied(); |
| 215 const ExtensionList* extensions = service->extensions(); | 215 const ExtensionList* extensions = service->extensions(); |
| 216 ASSERT_EQ(size_before + 1, extensions->size()); | 216 ASSERT_EQ(size_before + 1, extensions->size()); |
| 217 ASSERT_TRUE(service->HasInstalledExtensions()); | 217 ASSERT_TRUE(service->HasInstalledExtensions()); |
| 218 ASSERT_EQ("ogjcoiohnmldgjemafoockdghcjciccf", | 218 ASSERT_EQ("ogjcoiohnmldgjemafoockdghcjciccf", |
| 219 extensions->at(size_before)->id()); | 219 extensions->at(size_before)->id()); |
| 220 ASSERT_EQ("1.0", extensions->at(size_before)->VersionString()); | 220 ASSERT_EQ("1.0", extensions->at(size_before)->VersionString()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 246 // Make sure the extension state is the same as before. | 246 // Make sure the extension state is the same as before. |
| 247 extensions = service->extensions(); | 247 extensions = service->extensions(); |
| 248 ASSERT_EQ(size_before + 1, extensions->size()); | 248 ASSERT_EQ(size_before + 1, extensions->size()); |
| 249 ASSERT_EQ("ogjcoiohnmldgjemafoockdghcjciccf", | 249 ASSERT_EQ("ogjcoiohnmldgjemafoockdghcjciccf", |
| 250 extensions->at(size_before)->id()); | 250 extensions->at(size_before)->id()); |
| 251 ASSERT_EQ("2.0", extensions->at(size_before)->VersionString()); | 251 ASSERT_EQ("2.0", extensions->at(size_before)->VersionString()); |
| 252 } | 252 } |
| 253 | 253 |
| 254 // See http://crbug.com/57378 for flakiness details. | 254 // See http://crbug.com/57378 for flakiness details. |
| 255 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalUrlUpdate) { | 255 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalUrlUpdate) { |
| 256 ExtensionsService* service = browser()->profile()->GetExtensionsService(); | 256 ExtensionService* service = browser()->profile()->GetExtensionService(); |
| 257 const char* kExtensionId = "ogjcoiohnmldgjemafoockdghcjciccf"; | 257 const char* kExtensionId = "ogjcoiohnmldgjemafoockdghcjciccf"; |
| 258 // We don't want autoupdate blacklist checks. | 258 // We don't want autoupdate blacklist checks. |
| 259 service->updater()->set_blacklist_checks_enabled(false); | 259 service->updater()->set_blacklist_checks_enabled(false); |
| 260 | 260 |
| 261 FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); | 261 FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); |
| 262 | 262 |
| 263 // Note: This interceptor gets requests on the IO thread. | 263 // Note: This interceptor gets requests on the IO thread. |
| 264 scoped_refptr<AutoUpdateInterceptor> interceptor(new AutoUpdateInterceptor()); | 264 scoped_refptr<AutoUpdateInterceptor> interceptor(new AutoUpdateInterceptor()); |
| 265 URLFetcher::enable_interception_for_tests(true); | 265 URLFetcher::enable_interception_for_tests(true); |
| 266 | 266 |
| 267 interceptor->SetResponseOnIOThread("http://localhost/autoupdate/manifest", | 267 interceptor->SetResponseOnIOThread("http://localhost/autoupdate/manifest", |
| 268 basedir.AppendASCII("manifest_v2.xml")); | 268 basedir.AppendASCII("manifest_v2.xml")); |
| 269 interceptor->SetResponseOnIOThread("http://localhost/autoupdate/v2.crx", | 269 interceptor->SetResponseOnIOThread("http://localhost/autoupdate/v2.crx", |
| 270 basedir.AppendASCII("v2.crx")); | 270 basedir.AppendASCII("v2.crx")); |
| 271 | 271 |
| 272 const size_t size_before = service->extensions()->size(); | 272 const size_t size_before = service->extensions()->size(); |
| 273 ASSERT_TRUE(service->disabled_extensions()->empty()); | 273 ASSERT_TRUE(service->disabled_extensions()->empty()); |
| 274 | 274 |
| 275 // The code that reads external_extensions.json uses this method to inform | 275 // The code that reads external_extensions.json uses this method to inform |
| 276 // the ExtensionsService of an extension to download. Using the real code | 276 // the ExtensionService of an extension to download. Using the real code |
| 277 // is race-prone, because instantating the ExtensionService starts a read | 277 // is race-prone, because instantating the ExtensionService starts a read |
| 278 // of external_extensions.json before this test function starts. | 278 // of external_extensions.json before this test function starts. |
| 279 service->AddPendingExtensionFromExternalUpdateUrl( | 279 service->AddPendingExtensionFromExternalUpdateUrl( |
| 280 kExtensionId, GURL("http://localhost/autoupdate/manifest"), | 280 kExtensionId, GURL("http://localhost/autoupdate/manifest"), |
| 281 Extension::EXTERNAL_PREF_DOWNLOAD); | 281 Extension::EXTERNAL_PREF_DOWNLOAD); |
| 282 | 282 |
| 283 // Run autoupdate and make sure version 2 of the extension was installed. | 283 // Run autoupdate and make sure version 2 of the extension was installed. |
| 284 service->updater()->CheckNow(); | 284 service->updater()->CheckNow(); |
| 285 ASSERT_TRUE(WaitForExtensionInstall()); | 285 ASSERT_TRUE(WaitForExtensionInstall()); |
| 286 const ExtensionList* extensions = service->extensions(); | 286 const ExtensionList* extensions = service->extensions(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 | 318 |
| 319 // Uninstalling from a non-external source should not set the kill bit. | 319 // Uninstalling from a non-external source should not set the kill bit. |
| 320 UninstallExtension(kExtensionId); | 320 UninstallExtension(kExtensionId); |
| 321 | 321 |
| 322 EXPECT_FALSE(extension_prefs->IsExtensionKilled(kExtensionId)) | 322 EXPECT_FALSE(extension_prefs->IsExtensionKilled(kExtensionId)) |
| 323 << "Uninstalling non-external extension should not set kill bit."; | 323 << "Uninstalling non-external extension should not set kill bit."; |
| 324 } | 324 } |
| 325 | 325 |
| 326 // See http://crbug.com/57378 for flakiness details. | 326 // See http://crbug.com/57378 for flakiness details. |
| 327 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalPolicyRefresh) { | 327 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalPolicyRefresh) { |
| 328 ExtensionsService* service = browser()->profile()->GetExtensionsService(); | 328 ExtensionService* service = browser()->profile()->GetExtensionService(); |
| 329 const char* kExtensionId = "ogjcoiohnmldgjemafoockdghcjciccf"; | 329 const char* kExtensionId = "ogjcoiohnmldgjemafoockdghcjciccf"; |
| 330 // We don't want autoupdate blacklist checks. | 330 // We don't want autoupdate blacklist checks. |
| 331 service->updater()->set_blacklist_checks_enabled(false); | 331 service->updater()->set_blacklist_checks_enabled(false); |
| 332 | 332 |
| 333 FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); | 333 FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); |
| 334 | 334 |
| 335 // Note: This interceptor gets requests on the IO thread. | 335 // Note: This interceptor gets requests on the IO thread. |
| 336 scoped_refptr<AutoUpdateInterceptor> interceptor(new AutoUpdateInterceptor()); | 336 scoped_refptr<AutoUpdateInterceptor> interceptor(new AutoUpdateInterceptor()); |
| 337 URLFetcher::enable_interception_for_tests(true); | 337 URLFetcher::enable_interception_for_tests(true); |
| 338 | 338 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 361 const ExtensionList* extensions = service->extensions(); | 361 const ExtensionList* extensions = service->extensions(); |
| 362 ASSERT_EQ(size_before + 1, extensions->size()); | 362 ASSERT_EQ(size_before + 1, extensions->size()); |
| 363 ASSERT_EQ(kExtensionId, extensions->at(size_before)->id()); | 363 ASSERT_EQ(kExtensionId, extensions->at(size_before)->id()); |
| 364 EXPECT_EQ("2.0", extensions->at(size_before)->VersionString()); | 364 EXPECT_EQ("2.0", extensions->at(size_before)->VersionString()); |
| 365 EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, | 365 EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, |
| 366 extensions->at(size_before)->location()); | 366 extensions->at(size_before)->location()); |
| 367 | 367 |
| 368 // Check that emptying the list doesn't cause any trouble. | 368 // Check that emptying the list doesn't cause any trouble. |
| 369 prefs->ClearPref(prefs::kExtensionInstallForceList); | 369 prefs->ClearPref(prefs::kExtensionInstallForceList); |
| 370 } | 370 } |
| OLD | NEW |