| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/run_loop.h" |
| 10 #include "base/threading/sequenced_worker_pool.h" | 11 #include "base/threading/sequenced_worker_pool.h" |
| 11 #include "chrome/app/chrome_command_ids.h" | 12 #include "chrome/app/chrome_command_ids.h" |
| 12 #include "chrome/browser/extensions/extension_browsertest.h" | 13 #include "chrome/browser/extensions/extension_browsertest.h" |
| 13 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
| 14 #include "chrome/browser/extensions/extension_sync_data.h" | 15 #include "chrome/browser/extensions/extension_sync_data.h" |
| 15 #include "chrome/browser/extensions/extension_sync_service.h" | 16 #include "chrome/browser/extensions/extension_sync_service.h" |
| 16 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 17 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
| 17 #include "chrome/browser/extensions/updater/extension_updater.h" | 18 #include "chrome/browser/extensions/updater/extension_updater.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 base::FilePath path_v3_; | 128 base::FilePath path_v3_; |
| 128 extensions::ScopedIgnoreContentVerifierForTest ignore_content_verification_; | 129 extensions::ScopedIgnoreContentVerifierForTest ignore_content_verification_; |
| 129 }; | 130 }; |
| 130 | 131 |
| 131 // Tests the process of updating an extension to one that requires higher | 132 // Tests the process of updating an extension to one that requires higher |
| 132 // permissions, and accepting the permissions. | 133 // permissions, and accepting the permissions. |
| 133 IN_PROC_BROWSER_TEST_F(ExtensionDisabledGlobalErrorTest, AcceptPermissions) { | 134 IN_PROC_BROWSER_TEST_F(ExtensionDisabledGlobalErrorTest, AcceptPermissions) { |
| 134 const Extension* extension = InstallAndUpdateIncreasingPermissionsExtension(); | 135 const Extension* extension = InstallAndUpdateIncreasingPermissionsExtension(); |
| 135 ASSERT_TRUE(extension); | 136 ASSERT_TRUE(extension); |
| 136 ASSERT_TRUE(GetExtensionDisabledGlobalError()); | 137 ASSERT_TRUE(GetExtensionDisabledGlobalError()); |
| 138 |
| 139 GetExtensionDisabledGlobalError()->ShowBubbleView(browser()); |
| 140 base::RunLoop().Run(); |
| 141 |
| 137 const size_t size_before = registry_->enabled_extensions().size(); | 142 const size_t size_before = registry_->enabled_extensions().size(); |
| 138 | 143 |
| 139 ExtensionTestMessageListener listener("v2.onInstalled", false); | 144 ExtensionTestMessageListener listener("v2.onInstalled", false); |
| 140 listener.set_failure_message("FAILED"); | 145 listener.set_failure_message("FAILED"); |
| 141 service_->GrantPermissionsAndEnableExtension(extension); | 146 service_->GrantPermissionsAndEnableExtension(extension); |
| 142 EXPECT_EQ(size_before + 1, registry_->enabled_extensions().size()); | 147 EXPECT_EQ(size_before + 1, registry_->enabled_extensions().size()); |
| 143 EXPECT_EQ(0u, registry_->disabled_extensions().size()); | 148 EXPECT_EQ(0u, registry_->disabled_extensions().size()); |
| 144 ASSERT_FALSE(GetExtensionDisabledGlobalError()); | 149 ASSERT_FALSE(GetExtensionDisabledGlobalError()); |
| 145 // Expect onInstalled event to fire. | 150 // Expect onInstalled event to fire. |
| 146 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 151 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 | 319 |
| 315 const Extension* extension = service_->GetExtensionById(extension_id, true); | 320 const Extension* extension = service_->GetExtensionById(extension_id, true); |
| 316 ASSERT_TRUE(extension); | 321 ASSERT_TRUE(extension); |
| 317 EXPECT_EQ("2", extension->VersionString()); | 322 EXPECT_EQ("2", extension->VersionString()); |
| 318 EXPECT_EQ(1u, registry_->disabled_extensions().size()); | 323 EXPECT_EQ(1u, registry_->disabled_extensions().size()); |
| 319 EXPECT_EQ(Extension::DISABLE_REMOTE_INSTALL, | 324 EXPECT_EQ(Extension::DISABLE_REMOTE_INSTALL, |
| 320 ExtensionPrefs::Get(service_->profile()) | 325 ExtensionPrefs::Get(service_->profile()) |
| 321 ->GetDisableReasons(extension_id)); | 326 ->GetDisableReasons(extension_id)); |
| 322 EXPECT_TRUE(GetExtensionDisabledGlobalError()); | 327 EXPECT_TRUE(GetExtensionDisabledGlobalError()); |
| 323 } | 328 } |
| OLD | NEW |