| 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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 } | 419 } |
| 420 | 420 |
| 421 // Dispatch a fake alarm event to the app. | 421 // Dispatch a fake alarm event to the app. |
| 422 void DispatchAlarmEvent(EventRouter* event_router, | 422 void DispatchAlarmEvent(EventRouter* event_router, |
| 423 const std::string& app_id) { | 423 const std::string& app_id) { |
| 424 alarms::Alarm dummy_alarm; | 424 alarms::Alarm dummy_alarm; |
| 425 dummy_alarm.name = "test_alarm"; | 425 dummy_alarm.name = "test_alarm"; |
| 426 | 426 |
| 427 scoped_ptr<base::ListValue> args(new base::ListValue()); | 427 scoped_ptr<base::ListValue> args(new base::ListValue()); |
| 428 args->Append(dummy_alarm.ToValue().release()); | 428 args->Append(dummy_alarm.ToValue().release()); |
| 429 scoped_ptr<Event> event(new Event(alarms::OnAlarm::kEventName, | 429 scoped_ptr<Event> event(new Event( |
| 430 args.Pass())); | 430 extensions::events::UNKNOWN, alarms::OnAlarm::kEventName, args.Pass())); |
| 431 | 431 |
| 432 event_router->DispatchEventToExtension(app_id, event.Pass()); | 432 event_router->DispatchEventToExtension(app_id, event.Pass()); |
| 433 } | 433 } |
| 434 | 434 |
| 435 // Simulates the scenario where an app is installed, via the normal | 435 // Simulates the scenario where an app is installed, via the normal |
| 436 // installation route, on top of an ephemeral app. This can occur due to race | 436 // installation route, on top of an ephemeral app. This can occur due to race |
| 437 // conditions. | 437 // conditions. |
| 438 const Extension* ReplaceEphemeralApp(const std::string& app_id, | 438 const Extension* ReplaceEphemeralApp(const std::string& app_id, |
| 439 const char* test_path, | 439 const char* test_path, |
| 440 int expected_enabled_change) { | 440 int expected_enabled_change) { |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1024 base::Bind(&PowerSaveBlockerStub::Create, &power_settings)); | 1024 base::Bind(&PowerSaveBlockerStub::Create, &power_settings)); |
| 1025 | 1025 |
| 1026 const Extension* app = InstallAndLaunchEphemeralApp(kPowerTestApp); | 1026 const Extension* app = InstallAndLaunchEphemeralApp(kPowerTestApp); |
| 1027 ASSERT_TRUE(app); | 1027 ASSERT_TRUE(app); |
| 1028 EXPECT_EQ(1, power_settings.keep_awake_count()); | 1028 EXPECT_EQ(1, power_settings.keep_awake_count()); |
| 1029 | 1029 |
| 1030 CloseAppWaitForUnload(app->id()); | 1030 CloseAppWaitForUnload(app->id()); |
| 1031 | 1031 |
| 1032 EXPECT_EQ(0, power_settings.keep_awake_count()); | 1032 EXPECT_EQ(0, power_settings.keep_awake_count()); |
| 1033 } | 1033 } |
| OLD | NEW |