| OLD | NEW |
| 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/thread_task_runner_handle.h" | 5 #include "base/thread_task_runner_handle.h" |
| 6 #include "chrome/browser/apps/ephemeral_app_launcher.h" | 6 #include "chrome/browser/apps/ephemeral_app_launcher.h" |
| 7 #include "chrome/browser/apps/ephemeral_app_service.h" | 7 #include "chrome/browser/apps/ephemeral_app_service.h" |
| 8 #include "chrome/browser/extensions/extension_install_checker.h" | 8 #include "chrome/browser/extensions/extension_install_checker.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/install_tracker.h" | 10 #include "chrome/browser/extensions/install_tracker.h" |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 Extension::DisableReason disable_reason) { | 280 Extension::DisableReason disable_reason) { |
| 281 const Extension* app = InstallExtension(GetTestPath(test_path), 1); | 281 const Extension* app = InstallExtension(GetTestPath(test_path), 1); |
| 282 EXPECT_TRUE(app); | 282 EXPECT_TRUE(app); |
| 283 if (!app) | 283 if (!app) |
| 284 return NULL; | 284 return NULL; |
| 285 | 285 |
| 286 ExtensionService* service = | 286 ExtensionService* service = |
| 287 ExtensionSystem::Get(profile())->extension_service(); | 287 ExtensionSystem::Get(profile())->extension_service(); |
| 288 service->DisableExtension(app->id(), disable_reason); | 288 service->DisableExtension(app->id(), disable_reason); |
| 289 | 289 |
| 290 if (disable_reason == Extension::DISABLE_PERMISSIONS_INCREASE) { | |
| 291 // When an extension is disabled due to a permissions increase, this | |
| 292 // flag needs to be set too, for some reason. | |
| 293 ExtensionPrefs::Get(profile()) | |
| 294 ->SetDidExtensionEscalatePermissions(app, true); | |
| 295 } | |
| 296 | |
| 297 EXPECT_TRUE( | 290 EXPECT_TRUE( |
| 298 ExtensionRegistry::Get(profile())->disabled_extensions().Contains( | 291 ExtensionRegistry::Get(profile())->disabled_extensions().Contains( |
| 299 app->id())); | 292 app->id())); |
| 300 return app; | 293 return app; |
| 301 } | 294 } |
| 302 }; | 295 }; |
| 303 | 296 |
| 304 class EphemeralAppLauncherTestDisabled : public EphemeralAppLauncherTest { | 297 class EphemeralAppLauncherTestDisabled : public EphemeralAppLauncherTest { |
| 305 public: | 298 public: |
| 306 void SetUpCommandLine(base::CommandLine* command_line) override { | 299 void SetUpCommandLine(base::CommandLine* command_line) override { |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 } | 554 } |
| 562 | 555 |
| 563 // Verifies that a launch will fail if a duplicate launch is in progress. | 556 // Verifies that a launch will fail if a duplicate launch is in progress. |
| 564 IN_PROC_BROWSER_TEST_F(EphemeralAppLauncherTest, DuplicateLaunchInProgress) { | 557 IN_PROC_BROWSER_TEST_F(EphemeralAppLauncherTest, DuplicateLaunchInProgress) { |
| 565 extensions::ActiveInstallData install_data(kDefaultAppId); | 558 extensions::ActiveInstallData install_data(kDefaultAppId); |
| 566 install_data.is_ephemeral = true; | 559 install_data.is_ephemeral = true; |
| 567 InstallTracker::Get(profile())->AddActiveInstall(install_data); | 560 InstallTracker::Get(profile())->AddActiveInstall(install_data); |
| 568 | 561 |
| 569 RunLaunchTest(kDefaultAppId, webstore_install::LAUNCH_IN_PROGRESS, false); | 562 RunLaunchTest(kDefaultAppId, webstore_install::LAUNCH_IN_PROGRESS, false); |
| 570 } | 563 } |
| OLD | NEW |