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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 #endif | 285 #endif |
286 #endif | 286 #endif |
287 | 287 |
288 // Tests extension autoupdate. | 288 // Tests extension autoupdate. |
289 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, MAYBE_AutoUpdate) { | 289 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, MAYBE_AutoUpdate) { |
290 NotificationListener notification_listener; | 290 NotificationListener notification_listener; |
291 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); | 291 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); |
292 | 292 |
293 // Note: This interceptor gets requests on the IO thread. | 293 // Note: This interceptor gets requests on the IO thread. |
294 net::LocalHostTestURLRequestInterceptor interceptor( | 294 net::LocalHostTestURLRequestInterceptor interceptor( |
295 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 295 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), |
296 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( | 296 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( |
297 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 297 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
298 | 298 |
299 interceptor.SetResponseIgnoreQuery( | 299 interceptor.SetResponseIgnoreQuery( |
300 GURL("http://localhost/autoupdate/manifest"), | 300 GURL("http://localhost/autoupdate/manifest"), |
301 basedir.AppendASCII("manifest_v2.xml")); | 301 basedir.AppendASCII("manifest_v2.xml")); |
302 interceptor.SetResponseIgnoreQuery(GURL("http://localhost/autoupdate/v2.crx"), | 302 interceptor.SetResponseIgnoreQuery(GURL("http://localhost/autoupdate/v2.crx"), |
303 basedir.AppendASCII("v2.crx")); | 303 basedir.AppendASCII("v2.crx")); |
304 | 304 |
305 // Install version 1 of the extension. | 305 // Install version 1 of the extension. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 #endif | 375 #endif |
376 | 376 |
377 // Tests extension autoupdate. | 377 // Tests extension autoupdate. |
378 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, | 378 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, |
379 MAYBE_AutoUpdateDisabledExtensions) { | 379 MAYBE_AutoUpdateDisabledExtensions) { |
380 NotificationListener notification_listener; | 380 NotificationListener notification_listener; |
381 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); | 381 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); |
382 | 382 |
383 // Note: This interceptor gets requests on the IO thread. | 383 // Note: This interceptor gets requests on the IO thread. |
384 net::LocalHostTestURLRequestInterceptor interceptor( | 384 net::LocalHostTestURLRequestInterceptor interceptor( |
385 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 385 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), |
386 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( | 386 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( |
387 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 387 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
388 | 388 |
389 interceptor.SetResponseIgnoreQuery( | 389 interceptor.SetResponseIgnoreQuery( |
390 GURL("http://localhost/autoupdate/manifest"), | 390 GURL("http://localhost/autoupdate/manifest"), |
391 basedir.AppendASCII("manifest_v2.xml")); | 391 basedir.AppendASCII("manifest_v2.xml")); |
392 interceptor.SetResponseIgnoreQuery(GURL("http://localhost/autoupdate/v2.crx"), | 392 interceptor.SetResponseIgnoreQuery(GURL("http://localhost/autoupdate/v2.crx"), |
393 basedir.AppendASCII("v2.crx")); | 393 basedir.AppendASCII("v2.crx")); |
394 | 394 |
395 // Install version 1 of the extension. | 395 // Install version 1 of the extension. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalUrlUpdate) { | 444 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalUrlUpdate) { |
445 ExtensionService* service = extensions::ExtensionSystem::Get( | 445 ExtensionService* service = extensions::ExtensionSystem::Get( |
446 browser()->profile())->extension_service(); | 446 browser()->profile())->extension_service(); |
447 const char kExtensionId[] = "ogjcoiohnmldgjemafoockdghcjciccf"; | 447 const char kExtensionId[] = "ogjcoiohnmldgjemafoockdghcjciccf"; |
448 extensions::ExtensionUpdater::CheckParams params; | 448 extensions::ExtensionUpdater::CheckParams params; |
449 | 449 |
450 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); | 450 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); |
451 | 451 |
452 // Note: This interceptor gets requests on the IO thread. | 452 // Note: This interceptor gets requests on the IO thread. |
453 net::LocalHostTestURLRequestInterceptor interceptor( | 453 net::LocalHostTestURLRequestInterceptor interceptor( |
454 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 454 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), |
455 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( | 455 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( |
456 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 456 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
457 | 457 |
458 interceptor.SetResponseIgnoreQuery( | 458 interceptor.SetResponseIgnoreQuery( |
459 GURL("http://localhost/autoupdate/manifest"), | 459 GURL("http://localhost/autoupdate/manifest"), |
460 basedir.AppendASCII("manifest_v2.xml")); | 460 basedir.AppendASCII("manifest_v2.xml")); |
461 interceptor.SetResponseIgnoreQuery(GURL("http://localhost/autoupdate/v2.crx"), | 461 interceptor.SetResponseIgnoreQuery(GURL("http://localhost/autoupdate/v2.crx"), |
462 basedir.AppendASCII("v2.crx")); | 462 basedir.AppendASCII("v2.crx")); |
463 | 463 |
464 ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile()); | 464 ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile()); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 // See http://crbug.com/57378 for flakiness details. | 540 // See http://crbug.com/57378 for flakiness details. |
541 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalPolicyRefresh) { | 541 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalPolicyRefresh) { |
542 ExtensionService* service = extensions::ExtensionSystem::Get( | 542 ExtensionService* service = extensions::ExtensionSystem::Get( |
543 browser()->profile())->extension_service(); | 543 browser()->profile())->extension_service(); |
544 const char kExtensionId[] = "ogjcoiohnmldgjemafoockdghcjciccf"; | 544 const char kExtensionId[] = "ogjcoiohnmldgjemafoockdghcjciccf"; |
545 | 545 |
546 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); | 546 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); |
547 | 547 |
548 // Note: This interceptor gets requests on the IO thread. | 548 // Note: This interceptor gets requests on the IO thread. |
549 net::LocalHostTestURLRequestInterceptor interceptor( | 549 net::LocalHostTestURLRequestInterceptor interceptor( |
550 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 550 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), |
551 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( | 551 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( |
552 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 552 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
553 | 553 |
554 interceptor.SetResponseIgnoreQuery( | 554 interceptor.SetResponseIgnoreQuery( |
555 GURL("http://localhost/autoupdate/manifest"), | 555 GURL("http://localhost/autoupdate/manifest"), |
556 basedir.AppendASCII("manifest_v2.xml")); | 556 basedir.AppendASCII("manifest_v2.xml")); |
557 interceptor.SetResponseIgnoreQuery(GURL("http://localhost/autoupdate/v2.crx"), | 557 interceptor.SetResponseIgnoreQuery(GURL("http://localhost/autoupdate/v2.crx"), |
558 basedir.AppendASCII("v2.crx")); | 558 basedir.AppendASCII("v2.crx")); |
559 | 559 |
560 ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile()); | 560 ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile()); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 ExtensionService* service = extensions::ExtensionSystem::Get( | 621 ExtensionService* service = extensions::ExtensionSystem::Get( |
622 browser()->profile())->extension_service(); | 622 browser()->profile())->extension_service(); |
623 ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile()); | 623 ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile()); |
624 const char kExtensionId[] = "ogjcoiohnmldgjemafoockdghcjciccf"; | 624 const char kExtensionId[] = "ogjcoiohnmldgjemafoockdghcjciccf"; |
625 const size_t size_before = registry->enabled_extensions().size(); | 625 const size_t size_before = registry->enabled_extensions().size(); |
626 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); | 626 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); |
627 ASSERT_TRUE(registry->disabled_extensions().is_empty()); | 627 ASSERT_TRUE(registry->disabled_extensions().is_empty()); |
628 | 628 |
629 // Note: This interceptor gets requests on the IO thread. | 629 // Note: This interceptor gets requests on the IO thread. |
630 net::LocalHostTestURLRequestInterceptor interceptor( | 630 net::LocalHostTestURLRequestInterceptor interceptor( |
631 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 631 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), |
632 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( | 632 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( |
633 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 633 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
634 | 634 |
635 interceptor.SetResponseIgnoreQuery( | 635 interceptor.SetResponseIgnoreQuery( |
636 GURL("http://localhost/autoupdate/manifest"), | 636 GURL("http://localhost/autoupdate/manifest"), |
637 basedir.AppendASCII("manifest_v2.xml")); | 637 basedir.AppendASCII("manifest_v2.xml")); |
638 interceptor.SetResponseIgnoreQuery(GURL("http://localhost/autoupdate/v2.crx"), | 638 interceptor.SetResponseIgnoreQuery(GURL("http://localhost/autoupdate/v2.crx"), |
639 basedir.AppendASCII("v2.crx")); | 639 basedir.AppendASCII("v2.crx")); |
640 | 640 |
641 // Check that the policy is initially empty. | 641 // Check that the policy is initially empty. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 UpdateProviderPolicy(policies); | 708 UpdateProviderPolicy(policies); |
709 extension_observer.WaitForExtensionWillBeInstalled(); | 709 extension_observer.WaitForExtensionWillBeInstalled(); |
710 | 710 |
711 ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); | 711 ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); |
712 extension = service->GetExtensionById(kExtensionId, false); | 712 extension = service->GetExtensionById(kExtensionId, false); |
713 ASSERT_TRUE(extension); | 713 ASSERT_TRUE(extension); |
714 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location()); | 714 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location()); |
715 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); | 715 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); |
716 EXPECT_TRUE(registry->disabled_extensions().is_empty()); | 716 EXPECT_TRUE(registry->disabled_extensions().is_empty()); |
717 } | 717 } |
OLD | NEW |