| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 public: | 153 public: |
| 154 explicit PowerSaveBlockerStub(PowerSettingsMock* power_settings) | 154 explicit PowerSaveBlockerStub(PowerSettingsMock* power_settings) |
| 155 : power_settings_(power_settings) { | 155 : power_settings_(power_settings) { |
| 156 power_settings_->request_keep_awake(); | 156 power_settings_->request_keep_awake(); |
| 157 } | 157 } |
| 158 | 158 |
| 159 ~PowerSaveBlockerStub() override { power_settings_->release_keep_awake(); } | 159 ~PowerSaveBlockerStub() override { power_settings_->release_keep_awake(); } |
| 160 | 160 |
| 161 static scoped_ptr<PowerSaveBlocker> Create(PowerSettingsMock* power_settings, | 161 static scoped_ptr<PowerSaveBlocker> Create(PowerSettingsMock* power_settings, |
| 162 PowerSaveBlockerType type, | 162 PowerSaveBlockerType type, |
| 163 const std::string& reason) { | 163 Reason reason, |
| 164 const std::string& description) { |
| 164 return scoped_ptr<PowerSaveBlocker>( | 165 return scoped_ptr<PowerSaveBlocker>( |
| 165 new PowerSaveBlockerStub(power_settings)); | 166 new PowerSaveBlockerStub(power_settings)); |
| 166 } | 167 } |
| 167 | 168 |
| 168 private: | 169 private: |
| 169 PowerSettingsMock* power_settings_; // Not owned. | 170 PowerSettingsMock* power_settings_; // Not owned. |
| 170 | 171 |
| 171 DISALLOW_COPY_AND_ASSIGN(PowerSaveBlockerStub); | 172 DISALLOW_COPY_AND_ASSIGN(PowerSaveBlockerStub); |
| 172 }; | 173 }; |
| 173 | 174 |
| (...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1033 base::Bind(&PowerSaveBlockerStub::Create, &power_settings)); | 1034 base::Bind(&PowerSaveBlockerStub::Create, &power_settings)); |
| 1034 | 1035 |
| 1035 const Extension* app = InstallAndLaunchEphemeralApp(kPowerTestApp); | 1036 const Extension* app = InstallAndLaunchEphemeralApp(kPowerTestApp); |
| 1036 ASSERT_TRUE(app); | 1037 ASSERT_TRUE(app); |
| 1037 EXPECT_EQ(1, power_settings.keep_awake_count()); | 1038 EXPECT_EQ(1, power_settings.keep_awake_count()); |
| 1038 | 1039 |
| 1039 CloseAppWaitForUnload(app->id()); | 1040 CloseAppWaitForUnload(app->id()); |
| 1040 | 1041 |
| 1041 EXPECT_EQ(0, power_settings.keep_awake_count()); | 1042 EXPECT_EQ(0, power_settings.keep_awake_count()); |
| 1042 } | 1043 } |
| OLD | NEW |