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 "chrome/browser/apps/ephemeral_app_browsertest.h" | 5 #include "chrome/browser/apps/ephemeral_app_browsertest.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "apps/app_restore_service.h" | 9 #include "apps/app_restore_service.h" |
10 #include "apps/saved_files_service.h" | 10 #include "apps/saved_files_service.h" |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 const extensions::Extension* app) { | 286 const extensions::Extension* app) { |
287 ExtensionService* extension_service = | 287 ExtensionService* extension_service = |
288 ExtensionSystem::Get(profile())->extension_service(); | 288 ExtensionSystem::Get(profile())->extension_service(); |
289 ASSERT_TRUE(extension_service); | 289 ASSERT_TRUE(extension_service); |
290 extension_service->PromoteEphemeralApp(app, false); | 290 extension_service->PromoteEphemeralApp(app, false); |
291 } | 291 } |
292 | 292 |
293 void EphemeralAppTestBase::DisableEphemeralApp( | 293 void EphemeralAppTestBase::DisableEphemeralApp( |
294 const Extension* app, | 294 const Extension* app, |
295 Extension::DisableReason disable_reason) { | 295 Extension::DisableReason disable_reason) { |
296 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile()); | |
297 | |
298 // Disabling due to a permissions increase also involves setting the | |
299 // DidExtensionEscalatePermissions flag. | |
300 if (disable_reason == Extension::DISABLE_PERMISSIONS_INCREASE) | |
301 prefs->SetDidExtensionEscalatePermissions(app, true); | |
302 | |
303 ExtensionSystem::Get(profile())->extension_service()->DisableExtension( | 296 ExtensionSystem::Get(profile())->extension_service()->DisableExtension( |
304 app->id(), disable_reason); | 297 app->id(), disable_reason); |
305 | 298 |
306 ASSERT_TRUE(ExtensionRegistry::Get(profile())->disabled_extensions().Contains( | 299 ASSERT_TRUE(ExtensionRegistry::Get(profile())->disabled_extensions().Contains( |
307 app->id())); | 300 app->id())); |
308 } | 301 } |
309 | 302 |
310 void EphemeralAppTestBase::CloseApp(const std::string& app_id) { | 303 void EphemeralAppTestBase::CloseApp(const std::string& app_id) { |
311 EXPECT_EQ(1U, GetAppWindowCountForApp(app_id)); | 304 EXPECT_EQ(1U, GetAppWindowCountForApp(app_id)); |
312 extensions::AppWindow* app_window = GetFirstAppWindowForApp(app_id); | 305 extensions::AppWindow* app_window = GetFirstAppWindowForApp(app_id); |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 base::Bind(&PowerSaveBlockerStub::Create, &power_settings)); | 1024 base::Bind(&PowerSaveBlockerStub::Create, &power_settings)); |
1032 | 1025 |
1033 const Extension* app = InstallAndLaunchEphemeralApp(kPowerTestApp); | 1026 const Extension* app = InstallAndLaunchEphemeralApp(kPowerTestApp); |
1034 ASSERT_TRUE(app); | 1027 ASSERT_TRUE(app); |
1035 EXPECT_EQ(1, power_settings.keep_awake_count()); | 1028 EXPECT_EQ(1, power_settings.keep_awake_count()); |
1036 | 1029 |
1037 CloseAppWaitForUnload(app->id()); | 1030 CloseAppWaitForUnload(app->id()); |
1038 | 1031 |
1039 EXPECT_EQ(0, power_settings.keep_awake_count()); | 1032 EXPECT_EQ(0, power_settings.keep_awake_count()); |
1040 } | 1033 } |
OLD | NEW |