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/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/threading/sequenced_worker_pool.h" | 8 #include "base/threading/sequenced_worker_pool.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/extensions/extension_browsertest.h" | 10 #include "chrome/browser/extensions/extension_browsertest.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 int expected_change) { | 80 int expected_change) { |
81 size_t size_before = service_->extensions()->size(); | 81 size_t size_before = service_->extensions()->size(); |
82 if (UpdateExtension(extension->id(), crx_path, expected_change)) | 82 if (UpdateExtension(extension->id(), crx_path, expected_change)) |
83 return NULL; | 83 return NULL; |
84 BrowserThread::GetBlockingPool()->FlushForTesting(); | 84 BrowserThread::GetBlockingPool()->FlushForTesting(); |
85 base::RunLoop().RunUntilIdle(); | 85 base::RunLoop().RunUntilIdle(); |
86 EXPECT_EQ(size_before + expected_change, service_->extensions()->size()); | 86 EXPECT_EQ(size_before + expected_change, service_->extensions()->size()); |
87 if (service_->disabled_extensions()->size() != 1u) | 87 if (service_->disabled_extensions()->size() != 1u) |
88 return NULL; | 88 return NULL; |
89 | 89 |
90 return *service_->disabled_extensions()->begin(); | 90 return service_->disabled_extensions()->begin()->get(); |
91 } | 91 } |
92 | 92 |
93 // Helper function to install an extension and upgrade it to a version | 93 // Helper function to install an extension and upgrade it to a version |
94 // requiring additional permissions. Returns the new disabled Extension. | 94 // requiring additional permissions. Returns the new disabled Extension. |
95 const Extension* InstallAndUpdateIncreasingPermissionsExtension() { | 95 const Extension* InstallAndUpdateIncreasingPermissionsExtension() { |
96 const Extension* extension = InstallIncreasingPermissionExtensionV1(); | 96 const Extension* extension = InstallIncreasingPermissionExtensionV1(); |
97 extension = UpdateIncreasingPermissionExtension(extension, path_v2_, -1); | 97 extension = UpdateIncreasingPermissionExtension(extension, path_v2_, -1); |
98 return extension; | 98 return extension; |
99 } | 99 } |
100 | 100 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 base::RunLoop().RunUntilIdle(); | 215 base::RunLoop().RunUntilIdle(); |
216 | 216 |
217 extension = service_->GetExtensionById(extension_id, true); | 217 extension = service_->GetExtensionById(extension_id, true); |
218 ASSERT_TRUE(extension); | 218 ASSERT_TRUE(extension); |
219 EXPECT_EQ("2", extension->VersionString()); | 219 EXPECT_EQ("2", extension->VersionString()); |
220 EXPECT_EQ(1u, service_->disabled_extensions()->size()); | 220 EXPECT_EQ(1u, service_->disabled_extensions()->size()); |
221 EXPECT_EQ(Extension::DISABLE_PERMISSIONS_INCREASE, | 221 EXPECT_EQ(Extension::DISABLE_PERMISSIONS_INCREASE, |
222 service_->extension_prefs()->GetDisableReasons(extension_id)); | 222 service_->extension_prefs()->GetDisableReasons(extension_id)); |
223 EXPECT_TRUE(GetExtensionDisabledGlobalError()); | 223 EXPECT_TRUE(GetExtensionDisabledGlobalError()); |
224 } | 224 } |
OLD | NEW |