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/task_scheduler/post_task.h" | 10 #include "base/task_scheduler/post_task.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 UninstallExtension(extension_id); | 227 UninstallExtension(extension_id); |
228 extension = NULL; | 228 extension = NULL; |
229 | 229 |
230 // Install extension v1. | 230 // Install extension v1. |
231 InstallIncreasingPermissionExtensionV1(); | 231 InstallIncreasingPermissionExtensionV1(); |
232 | 232 |
233 // Note: This interceptor gets requests on the IO thread. | 233 // Note: This interceptor gets requests on the IO thread. |
234 net::LocalHostTestURLRequestInterceptor interceptor( | 234 net::LocalHostTestURLRequestInterceptor interceptor( |
235 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), | 235 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), |
236 base::CreateTaskRunnerWithTraits( | 236 base::CreateTaskRunnerWithTraits( |
237 base::TaskTraits() | 237 {base::MayBlock(), base::TaskPriority::BACKGROUND, |
238 .MayBlock() | 238 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN})); |
239 .WithPriority(base::TaskPriority::BACKGROUND) | |
240 .WithShutdownBehavior( | |
241 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN))); | |
242 interceptor.SetResponseIgnoreQuery( | 239 interceptor.SetResponseIgnoreQuery( |
243 GURL("http://localhost/autoupdate/updates.xml"), | 240 GURL("http://localhost/autoupdate/updates.xml"), |
244 test_data_dir_.AppendASCII("permissions_increase") | 241 test_data_dir_.AppendASCII("permissions_increase") |
245 .AppendASCII("updates.xml")); | 242 .AppendASCII("updates.xml")); |
246 interceptor.SetResponseIgnoreQuery( | 243 interceptor.SetResponseIgnoreQuery( |
247 GURL("http://localhost/autoupdate/v2.crx"), | 244 GURL("http://localhost/autoupdate/v2.crx"), |
248 scoped_temp_dir_.GetPath().AppendASCII("permissions2.crx")); | 245 scoped_temp_dir_.GetPath().AppendASCII("permissions2.crx")); |
249 | 246 |
250 sync_service->MergeDataAndStartSyncing( | 247 sync_service->MergeDataAndStartSyncing( |
251 syncer::EXTENSIONS, syncer::SyncDataList(), | 248 syncer::EXTENSIONS, syncer::SyncDataList(), |
(...skipping 19 matching lines...) Expand all Loading... |
271 } | 268 } |
272 | 269 |
273 // Test that an error appears if an extension gets installed server side. | 270 // Test that an error appears if an extension gets installed server side. |
274 IN_PROC_BROWSER_TEST_F(ExtensionDisabledGlobalErrorTest, RemoteInstall) { | 271 IN_PROC_BROWSER_TEST_F(ExtensionDisabledGlobalErrorTest, RemoteInstall) { |
275 static const char extension_id[] = "pgdpcfcocojkjfbgpiianjngphoopgmo"; | 272 static const char extension_id[] = "pgdpcfcocojkjfbgpiianjngphoopgmo"; |
276 | 273 |
277 // Note: This interceptor gets requests on the IO thread. | 274 // Note: This interceptor gets requests on the IO thread. |
278 net::LocalHostTestURLRequestInterceptor interceptor( | 275 net::LocalHostTestURLRequestInterceptor interceptor( |
279 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), | 276 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), |
280 base::CreateTaskRunnerWithTraits( | 277 base::CreateTaskRunnerWithTraits( |
281 base::TaskTraits() | 278 {base::MayBlock(), base::TaskPriority::BACKGROUND, |
282 .MayBlock() | 279 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN})); |
283 .WithPriority(base::TaskPriority::BACKGROUND) | |
284 .WithShutdownBehavior( | |
285 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN))); | |
286 interceptor.SetResponseIgnoreQuery( | 280 interceptor.SetResponseIgnoreQuery( |
287 GURL("http://localhost/autoupdate/updates.xml"), | 281 GURL("http://localhost/autoupdate/updates.xml"), |
288 test_data_dir_.AppendASCII("permissions_increase") | 282 test_data_dir_.AppendASCII("permissions_increase") |
289 .AppendASCII("updates.xml")); | 283 .AppendASCII("updates.xml")); |
290 interceptor.SetResponseIgnoreQuery( | 284 interceptor.SetResponseIgnoreQuery( |
291 GURL("http://localhost/autoupdate/v2.crx"), | 285 GURL("http://localhost/autoupdate/v2.crx"), |
292 scoped_temp_dir_.GetPath().AppendASCII("permissions2.crx")); | 286 scoped_temp_dir_.GetPath().AppendASCII("permissions2.crx")); |
293 | 287 |
294 sync_pb::EntitySpecifics specifics; | 288 sync_pb::EntitySpecifics specifics; |
295 specifics.mutable_extension()->set_id(extension_id); | 289 specifics.mutable_extension()->set_id(extension_id); |
(...skipping 28 matching lines...) Expand all Loading... |
324 | 318 |
325 const Extension* extension = service_->GetExtensionById(extension_id, true); | 319 const Extension* extension = service_->GetExtensionById(extension_id, true); |
326 ASSERT_TRUE(extension); | 320 ASSERT_TRUE(extension); |
327 EXPECT_EQ("2", extension->VersionString()); | 321 EXPECT_EQ("2", extension->VersionString()); |
328 EXPECT_EQ(1u, registry_->disabled_extensions().size()); | 322 EXPECT_EQ(1u, registry_->disabled_extensions().size()); |
329 EXPECT_EQ(Extension::DISABLE_REMOTE_INSTALL, | 323 EXPECT_EQ(Extension::DISABLE_REMOTE_INSTALL, |
330 ExtensionPrefs::Get(service_->profile()) | 324 ExtensionPrefs::Get(service_->profile()) |
331 ->GetDisableReasons(extension_id)); | 325 ->GetDisableReasons(extension_id)); |
332 EXPECT_TRUE(GetExtensionDisabledGlobalError()); | 326 EXPECT_TRUE(GetExtensionDisabledGlobalError()); |
333 } | 327 } |
OLD | NEW |