| 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/prefs/scoped_user_pref_update.h" | 8 #include "base/prefs/scoped_user_pref_update.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 ASSERT_TRUE(notification_listener.started()); | 432 ASSERT_TRUE(notification_listener.started()); |
| 433 ASSERT_TRUE(notification_listener.finished()); | 433 ASSERT_TRUE(notification_listener.finished()); |
| 434 ASSERT_TRUE(ContainsKey(notification_listener.updates(), | 434 ASSERT_TRUE(ContainsKey(notification_listener.updates(), |
| 435 "ogjcoiohnmldgjemafoockdghcjciccf")); | 435 "ogjcoiohnmldgjemafoockdghcjciccf")); |
| 436 notification_listener.Reset(); | 436 notification_listener.Reset(); |
| 437 } | 437 } |
| 438 | 438 |
| 439 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalUrlUpdate) { | 439 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalUrlUpdate) { |
| 440 ExtensionService* service = extensions::ExtensionSystem::Get( | 440 ExtensionService* service = extensions::ExtensionSystem::Get( |
| 441 browser()->profile())->extension_service(); | 441 browser()->profile())->extension_service(); |
| 442 const char* kExtensionId = "ogjcoiohnmldgjemafoockdghcjciccf"; | 442 const char kExtensionId[] = "ogjcoiohnmldgjemafoockdghcjciccf"; |
| 443 extensions::ExtensionUpdater::CheckParams params; | 443 extensions::ExtensionUpdater::CheckParams params; |
| 444 | 444 |
| 445 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); | 445 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); |
| 446 | 446 |
| 447 // Note: This interceptor gets requests on the IO thread. | 447 // Note: This interceptor gets requests on the IO thread. |
| 448 net::LocalHostTestURLRequestInterceptor interceptor( | 448 net::LocalHostTestURLRequestInterceptor interceptor( |
| 449 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 449 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
| 450 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( | 450 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( |
| 451 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 451 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
| 452 net::URLFetcher::SetEnableInterceptionForTests(true); | 452 net::URLFetcher::SetEnableInterceptionForTests(true); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 | 517 |
| 518 // Uninstalling from a non-external source should not set the kill bit. | 518 // Uninstalling from a non-external source should not set the kill bit. |
| 519 UninstallExtension(kExtensionId); | 519 UninstallExtension(kExtensionId); |
| 520 | 520 |
| 521 EXPECT_FALSE(extension_prefs->IsExternalExtensionUninstalled(kExtensionId)) | 521 EXPECT_FALSE(extension_prefs->IsExternalExtensionUninstalled(kExtensionId)) |
| 522 << "Uninstalling non-external extension should not set kill bit."; | 522 << "Uninstalling non-external extension should not set kill bit."; |
| 523 } | 523 } |
| 524 | 524 |
| 525 namespace { | 525 namespace { |
| 526 | 526 |
| 527 const char* kForceInstallNotEmptyHelp = | 527 const char kForceInstallNotEmptyHelp[] = |
| 528 "A policy may already be controlling the list of force-installed " | 528 "A policy may already be controlling the list of force-installed " |
| 529 "extensions. Please remove all policy settings from your computer " | 529 "extensions. Please remove all policy settings from your computer " |
| 530 "before running tests. E.g. from /etc/chromium/policies Linux or " | 530 "before running tests. E.g. from /etc/chromium/policies Linux or " |
| 531 "from the registry on Windows, etc."; | 531 "from the registry on Windows, etc."; |
| 532 | 532 |
| 533 } | 533 } |
| 534 | 534 |
| 535 // See http://crbug.com/57378 for flakiness details. | 535 // See http://crbug.com/57378 for flakiness details. |
| 536 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalPolicyRefresh) { | 536 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalPolicyRefresh) { |
| 537 ExtensionService* service = extensions::ExtensionSystem::Get( | 537 ExtensionService* service = extensions::ExtensionSystem::Get( |
| 538 browser()->profile())->extension_service(); | 538 browser()->profile())->extension_service(); |
| 539 const char* kExtensionId = "ogjcoiohnmldgjemafoockdghcjciccf"; | 539 const char kExtensionId[] = "ogjcoiohnmldgjemafoockdghcjciccf"; |
| 540 | 540 |
| 541 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); | 541 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); |
| 542 | 542 |
| 543 // Note: This interceptor gets requests on the IO thread. | 543 // Note: This interceptor gets requests on the IO thread. |
| 544 net::LocalHostTestURLRequestInterceptor interceptor( | 544 net::LocalHostTestURLRequestInterceptor interceptor( |
| 545 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 545 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
| 546 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( | 546 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( |
| 547 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 547 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
| 548 net::URLFetcher::SetEnableInterceptionForTests(true); | 548 net::URLFetcher::SetEnableInterceptionForTests(true); |
| 549 | 549 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 #define MAYBE_PolicyOverridesUserInstall DISABLED_PolicyOverridesUserInstall | 610 #define MAYBE_PolicyOverridesUserInstall DISABLED_PolicyOverridesUserInstall |
| 611 #else | 611 #else |
| 612 #define MAYBE_PolicyOverridesUserInstall PolicyOverridesUserInstall | 612 #define MAYBE_PolicyOverridesUserInstall PolicyOverridesUserInstall |
| 613 #endif | 613 #endif |
| 614 | 614 |
| 615 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, | 615 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, |
| 616 MAYBE_PolicyOverridesUserInstall) { | 616 MAYBE_PolicyOverridesUserInstall) { |
| 617 ExtensionService* service = extensions::ExtensionSystem::Get( | 617 ExtensionService* service = extensions::ExtensionSystem::Get( |
| 618 browser()->profile())->extension_service(); | 618 browser()->profile())->extension_service(); |
| 619 ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile()); | 619 ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile()); |
| 620 const char* kExtensionId = "ogjcoiohnmldgjemafoockdghcjciccf"; | 620 const char kExtensionId[] = "ogjcoiohnmldgjemafoockdghcjciccf"; |
| 621 extensions::ExtensionUpdater::CheckParams params; | 621 extensions::ExtensionUpdater::CheckParams params; |
| 622 service->updater()->set_default_check_params(params); | 622 service->updater()->set_default_check_params(params); |
| 623 const size_t size_before = registry->enabled_extensions().size(); | 623 const size_t size_before = registry->enabled_extensions().size(); |
| 624 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); | 624 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); |
| 625 ASSERT_TRUE(registry->disabled_extensions().is_empty()); | 625 ASSERT_TRUE(registry->disabled_extensions().is_empty()); |
| 626 | 626 |
| 627 // Note: This interceptor gets requests on the IO thread. | 627 // Note: This interceptor gets requests on the IO thread. |
| 628 net::LocalHostTestURLRequestInterceptor interceptor( | 628 net::LocalHostTestURLRequestInterceptor interceptor( |
| 629 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 629 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
| 630 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( | 630 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 UpdateProviderPolicy(policies); | 706 UpdateProviderPolicy(policies); |
| 707 | 707 |
| 708 ASSERT_TRUE(WaitForExtensionInstall()); | 708 ASSERT_TRUE(WaitForExtensionInstall()); |
| 709 ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); | 709 ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); |
| 710 extension = service->GetExtensionById(kExtensionId, false); | 710 extension = service->GetExtensionById(kExtensionId, false); |
| 711 ASSERT_TRUE(extension); | 711 ASSERT_TRUE(extension); |
| 712 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location()); | 712 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location()); |
| 713 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); | 713 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); |
| 714 EXPECT_TRUE(registry->disabled_extensions().is_empty()); | 714 EXPECT_TRUE(registry->disabled_extensions().is_empty()); |
| 715 } | 715 } |
| OLD | NEW |