Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: chrome/browser/extensions/api/management/management_browsertest.cc

Issue 635573005: Cleanup: Better constify some strings in chrome/browser/{chromeos,extensions}. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, nit Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 ASSERT_TRUE(notification_listener.started()); 430 ASSERT_TRUE(notification_listener.started());
431 ASSERT_TRUE(notification_listener.finished()); 431 ASSERT_TRUE(notification_listener.finished());
432 ASSERT_TRUE(ContainsKey(notification_listener.updates(), 432 ASSERT_TRUE(ContainsKey(notification_listener.updates(),
433 "ogjcoiohnmldgjemafoockdghcjciccf")); 433 "ogjcoiohnmldgjemafoockdghcjciccf"));
434 notification_listener.Reset(); 434 notification_listener.Reset();
435 } 435 }
436 436
437 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalUrlUpdate) { 437 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalUrlUpdate) {
438 ExtensionService* service = extensions::ExtensionSystem::Get( 438 ExtensionService* service = extensions::ExtensionSystem::Get(
439 browser()->profile())->extension_service(); 439 browser()->profile())->extension_service();
440 const char* kExtensionId = "ogjcoiohnmldgjemafoockdghcjciccf"; 440 const char kExtensionId[] = "ogjcoiohnmldgjemafoockdghcjciccf";
441 extensions::ExtensionUpdater::CheckParams params; 441 extensions::ExtensionUpdater::CheckParams params;
442 442
443 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); 443 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate");
444 444
445 // Note: This interceptor gets requests on the IO thread. 445 // Note: This interceptor gets requests on the IO thread.
446 net::LocalHostTestURLRequestInterceptor interceptor( 446 net::LocalHostTestURLRequestInterceptor interceptor(
447 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), 447 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
448 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( 448 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
449 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); 449 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
450 net::URLFetcher::SetEnableInterceptionForTests(true); 450 net::URLFetcher::SetEnableInterceptionForTests(true);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 515
516 // Uninstalling from a non-external source should not set the kill bit. 516 // Uninstalling from a non-external source should not set the kill bit.
517 UninstallExtension(kExtensionId); 517 UninstallExtension(kExtensionId);
518 518
519 EXPECT_FALSE(extension_prefs->IsExternalExtensionUninstalled(kExtensionId)) 519 EXPECT_FALSE(extension_prefs->IsExternalExtensionUninstalled(kExtensionId))
520 << "Uninstalling non-external extension should not set kill bit."; 520 << "Uninstalling non-external extension should not set kill bit.";
521 } 521 }
522 522
523 namespace { 523 namespace {
524 524
525 const char* kForceInstallNotEmptyHelp = 525 const char kForceInstallNotEmptyHelp[] =
526 "A policy may already be controlling the list of force-installed " 526 "A policy may already be controlling the list of force-installed "
527 "extensions. Please remove all policy settings from your computer " 527 "extensions. Please remove all policy settings from your computer "
528 "before running tests. E.g. from /etc/chromium/policies Linux or " 528 "before running tests. E.g. from /etc/chromium/policies Linux or "
529 "from the registry on Windows, etc."; 529 "from the registry on Windows, etc.";
530 530
531 } 531 }
532 532
533 // See http://crbug.com/57378 for flakiness details. 533 // See http://crbug.com/57378 for flakiness details.
534 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalPolicyRefresh) { 534 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalPolicyRefresh) {
535 ExtensionService* service = extensions::ExtensionSystem::Get( 535 ExtensionService* service = extensions::ExtensionSystem::Get(
536 browser()->profile())->extension_service(); 536 browser()->profile())->extension_service();
537 const char* kExtensionId = "ogjcoiohnmldgjemafoockdghcjciccf"; 537 const char kExtensionId[] = "ogjcoiohnmldgjemafoockdghcjciccf";
538 538
539 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); 539 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate");
540 540
541 // Note: This interceptor gets requests on the IO thread. 541 // Note: This interceptor gets requests on the IO thread.
542 net::LocalHostTestURLRequestInterceptor interceptor( 542 net::LocalHostTestURLRequestInterceptor interceptor(
543 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), 543 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
544 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( 544 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
545 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); 545 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
546 net::URLFetcher::SetEnableInterceptionForTests(true); 546 net::URLFetcher::SetEnableInterceptionForTests(true);
547 547
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 #define MAYBE_PolicyOverridesUserInstall DISABLED_PolicyOverridesUserInstall 608 #define MAYBE_PolicyOverridesUserInstall DISABLED_PolicyOverridesUserInstall
609 #else 609 #else
610 #define MAYBE_PolicyOverridesUserInstall PolicyOverridesUserInstall 610 #define MAYBE_PolicyOverridesUserInstall PolicyOverridesUserInstall
611 #endif 611 #endif
612 612
613 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, 613 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest,
614 MAYBE_PolicyOverridesUserInstall) { 614 MAYBE_PolicyOverridesUserInstall) {
615 ExtensionService* service = extensions::ExtensionSystem::Get( 615 ExtensionService* service = extensions::ExtensionSystem::Get(
616 browser()->profile())->extension_service(); 616 browser()->profile())->extension_service();
617 ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile()); 617 ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile());
618 const char* kExtensionId = "ogjcoiohnmldgjemafoockdghcjciccf"; 618 const char kExtensionId[] = "ogjcoiohnmldgjemafoockdghcjciccf";
619 extensions::ExtensionUpdater::CheckParams params; 619 extensions::ExtensionUpdater::CheckParams params;
620 service->updater()->set_default_check_params(params); 620 service->updater()->set_default_check_params(params);
621 const size_t size_before = registry->enabled_extensions().size(); 621 const size_t size_before = registry->enabled_extensions().size();
622 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); 622 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate");
623 ASSERT_TRUE(registry->disabled_extensions().is_empty()); 623 ASSERT_TRUE(registry->disabled_extensions().is_empty());
624 624
625 // Note: This interceptor gets requests on the IO thread. 625 // Note: This interceptor gets requests on the IO thread.
626 net::LocalHostTestURLRequestInterceptor interceptor( 626 net::LocalHostTestURLRequestInterceptor interceptor(
627 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), 627 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
628 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( 628 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 UpdateProviderPolicy(policies); 704 UpdateProviderPolicy(policies);
705 705
706 ASSERT_TRUE(WaitForExtensionInstall()); 706 ASSERT_TRUE(WaitForExtensionInstall());
707 ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); 707 ASSERT_EQ(size_before + 1, registry->enabled_extensions().size());
708 extension = service->GetExtensionById(kExtensionId, false); 708 extension = service->GetExtensionById(kExtensionId, false);
709 ASSERT_TRUE(extension); 709 ASSERT_TRUE(extension);
710 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location()); 710 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location());
711 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); 711 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId));
712 EXPECT_TRUE(registry->disabled_extensions().is_empty()); 712 EXPECT_TRUE(registry->disabled_extensions().is_empty());
713 } 713 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698