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

Side by Side Diff: chrome/browser/apps/ephemeral_app_launcher_browsertest.cc

Issue 397853002: Refactor safe-browsing build-config definitions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase to satiate trybots Created 6 years, 4 months 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/browser_process_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/message_loop/message_loop_proxy.h" 5 #include "base/message_loop/message_loop_proxy.h"
6 #include "chrome/browser/apps/ephemeral_app_launcher.h" 6 #include "chrome/browser/apps/ephemeral_app_launcher.h"
7 #include "chrome/browser/extensions/extension_install_checker.h" 7 #include "chrome/browser/extensions/extension_install_checker.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/extensions/extension_test_message_listener.h" 9 #include "chrome/browser/extensions/extension_test_message_listener.h"
10 #include "chrome/browser/extensions/install_tracker.h" 10 #include "chrome/browser/extensions/install_tracker.h"
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 IN_PROC_BROWSER_TEST_F(EphemeralAppLauncherTest, BlockedByPolicy) { 428 IN_PROC_BROWSER_TEST_F(EphemeralAppLauncherTest, BlockedByPolicy) {
429 // Register a provider that blocks the installation of all apps. 429 // Register a provider that blocks the installation of all apps.
430 ManagementPolicyMock policy; 430 ManagementPolicyMock policy;
431 ExtensionSystem::Get(profile())->management_policy()->RegisterProvider( 431 ExtensionSystem::Get(profile())->management_policy()->RegisterProvider(
432 &policy); 432 &policy);
433 433
434 RunLaunchTest(kDefaultAppId, webstore_install::BLOCKED_BY_POLICY, false); 434 RunLaunchTest(kDefaultAppId, webstore_install::BLOCKED_BY_POLICY, false);
435 EXPECT_FALSE(GetInstalledExtension(kDefaultAppId)); 435 EXPECT_FALSE(GetInstalledExtension(kDefaultAppId));
436 } 436 }
437 437
438 // The blacklist relies on safe-browsing database infrastructure.
439 #if defined(SAFE_BROWSING_DATABASE)
438 // Verifies that an app blacklisted for malware is not installed ephemerally. 440 // Verifies that an app blacklisted for malware is not installed ephemerally.
439 IN_PROC_BROWSER_TEST_F(EphemeralAppLauncherTest, BlacklistedForMalware) { 441 IN_PROC_BROWSER_TEST_F(EphemeralAppLauncherTest, BlacklistedForMalware) {
440 // Mock a BLACKLISTED_MALWARE return status. 442 // Mock a BLACKLISTED_MALWARE return status.
441 extensions::TestBlacklist blacklist_tester( 443 extensions::TestBlacklist blacklist_tester(
442 ExtensionSystem::Get(profile())->blacklist()); 444 ExtensionSystem::Get(profile())->blacklist());
443 blacklist_tester.SetBlacklistState( 445 blacklist_tester.SetBlacklistState(
444 kDefaultAppId, extensions::BLACKLISTED_MALWARE, false); 446 kDefaultAppId, extensions::BLACKLISTED_MALWARE, false);
445 447
446 RunLaunchTest(kDefaultAppId, webstore_install::BLACKLISTED, false); 448 RunLaunchTest(kDefaultAppId, webstore_install::BLACKLISTED, false);
447 EXPECT_FALSE(GetInstalledExtension(kDefaultAppId)); 449 EXPECT_FALSE(GetInstalledExtension(kDefaultAppId));
448 } 450 }
449 451
450 // Verifies that an app with unknown blacklist status is installed ephemerally 452 // Verifies that an app with unknown blacklist status is installed ephemerally
451 // and launched. 453 // and launched.
452 IN_PROC_BROWSER_TEST_F(EphemeralAppLauncherTest, BlacklistStateUnknown) { 454 IN_PROC_BROWSER_TEST_F(EphemeralAppLauncherTest, BlacklistStateUnknown) {
453 // Mock a BLACKLISTED_MALWARE return status. 455 // Mock a BLACKLISTED_MALWARE return status.
454 extensions::TestBlacklist blacklist_tester( 456 extensions::TestBlacklist blacklist_tester(
455 ExtensionSystem::Get(profile())->blacklist()); 457 ExtensionSystem::Get(profile())->blacklist());
456 blacklist_tester.SetBlacklistState( 458 blacklist_tester.SetBlacklistState(
457 kDefaultAppId, extensions::BLACKLISTED_UNKNOWN, false); 459 kDefaultAppId, extensions::BLACKLISTED_UNKNOWN, false);
458 460
459 RunLaunchTest(kDefaultAppId, webstore_install::SUCCESS, true); 461 RunLaunchTest(kDefaultAppId, webstore_install::SUCCESS, true);
460 ValidateAppInstalledEphemerally(kDefaultAppId); 462 ValidateAppInstalledEphemerally(kDefaultAppId);
461 } 463 }
464 #endif
462 465
463 // Verifies that an app with unsupported requirements is not installed 466 // Verifies that an app with unsupported requirements is not installed
464 // ephemerally. 467 // ephemerally.
465 IN_PROC_BROWSER_TEST_F(EphemeralAppLauncherTest, UnsupportedRequirements) { 468 IN_PROC_BROWSER_TEST_F(EphemeralAppLauncherTest, UnsupportedRequirements) {
466 scoped_refptr<EphemeralAppLauncherForTest> launcher( 469 scoped_refptr<EphemeralAppLauncherForTest> launcher(
467 new EphemeralAppLauncherForTest(kDefaultAppId, profile())); 470 new EphemeralAppLauncherForTest(kDefaultAppId, profile()));
468 launcher->set_requirements_error("App has unsupported requirements"); 471 launcher->set_requirements_error("App has unsupported requirements");
469 472
470 StartLauncherAndCheckResult( 473 StartLauncherAndCheckResult(
471 launcher.get(), webstore_install::REQUIREMENT_VIOLATIONS, false); 474 launcher.get(), webstore_install::REQUIREMENT_VIOLATIONS, false);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 } 541 }
539 542
540 // Verifies that a launch will fail if a duplicate launch is in progress. 543 // Verifies that a launch will fail if a duplicate launch is in progress.
541 IN_PROC_BROWSER_TEST_F(EphemeralAppLauncherTest, DuplicateLaunchInProgress) { 544 IN_PROC_BROWSER_TEST_F(EphemeralAppLauncherTest, DuplicateLaunchInProgress) {
542 extensions::ActiveInstallData install_data(kDefaultAppId); 545 extensions::ActiveInstallData install_data(kDefaultAppId);
543 install_data.is_ephemeral = true; 546 install_data.is_ephemeral = true;
544 InstallTracker::Get(profile())->AddActiveInstall(install_data); 547 InstallTracker::Get(profile())->AddActiveInstall(install_data);
545 548
546 RunLaunchTest(kDefaultAppId, webstore_install::LAUNCH_IN_PROGRESS, false); 549 RunLaunchTest(kDefaultAppId, webstore_install::LAUNCH_IN_PROGRESS, false);
547 } 550 }
OLDNEW
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/browser_process_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698