| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "apps/launcher.h" | 5 #include "apps/launcher.h" |
| 6 #include "apps/shell_window.h" | 6 #include "apps/shell_window.h" |
| 7 #include "apps/shell_window_registry.h" | 7 #include "apps/shell_window_registry.h" |
| 8 #include "apps/ui/native_app_window.h" | 8 #include "apps/ui/native_app_window.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1253 | 1253 |
| 1254 virtual void CleanUpOnMainThread() OVERRIDE { | 1254 virtual void CleanUpOnMainThread() OVERRIDE { |
| 1255 user_manager_enabler_.reset(); | 1255 user_manager_enabler_.reset(); |
| 1256 PlatformAppBrowserTest::CleanUpOnMainThread(); | 1256 PlatformAppBrowserTest::CleanUpOnMainThread(); |
| 1257 } | 1257 } |
| 1258 | 1258 |
| 1259 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE { | 1259 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE { |
| 1260 PlatformAppBrowserTest::TearDownInProcessBrowserTestFixture(); | 1260 PlatformAppBrowserTest::TearDownInProcessBrowserTestFixture(); |
| 1261 } | 1261 } |
| 1262 | 1262 |
| 1263 int request_restart_call_count() const { | 1263 int num_request_restart_calls() const { |
| 1264 return power_manager_client_->request_restart_call_count(); | 1264 return power_manager_client_->num_request_restart_calls(); |
| 1265 } | 1265 } |
| 1266 | 1266 |
| 1267 private: | 1267 private: |
| 1268 chromeos::FakePowerManagerClient* power_manager_client_; | 1268 chromeos::FakePowerManagerClient* power_manager_client_; |
| 1269 chromeos::MockUserManager* mock_user_manager_; | 1269 chromeos::MockUserManager* mock_user_manager_; |
| 1270 scoped_ptr<chromeos::ScopedUserManagerEnabler> user_manager_enabler_; | 1270 scoped_ptr<chromeos::ScopedUserManagerEnabler> user_manager_enabler_; |
| 1271 | 1271 |
| 1272 DISALLOW_COPY_AND_ASSIGN(RestartDeviceTest); | 1272 DISALLOW_COPY_AND_ASSIGN(RestartDeviceTest); |
| 1273 }; | 1273 }; |
| 1274 | 1274 |
| 1275 // Tests that chrome.runtime.restart would request device restart in | 1275 // Tests that chrome.runtime.restart would request device restart in |
| 1276 // ChromeOS kiosk mode. | 1276 // ChromeOS kiosk mode. |
| 1277 IN_PROC_BROWSER_TEST_F(RestartDeviceTest, Restart) { | 1277 IN_PROC_BROWSER_TEST_F(RestartDeviceTest, Restart) { |
| 1278 ASSERT_EQ(0, request_restart_call_count()); | 1278 ASSERT_EQ(0, num_request_restart_calls()); |
| 1279 | 1279 |
| 1280 ExtensionTestMessageListener launched_listener("Launched", true); | 1280 ExtensionTestMessageListener launched_listener("Launched", true); |
| 1281 const Extension* extension = LoadAndLaunchPlatformApp("restart_device"); | 1281 const Extension* extension = LoadAndLaunchPlatformApp("restart_device"); |
| 1282 ASSERT_TRUE(extension); | 1282 ASSERT_TRUE(extension); |
| 1283 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); | 1283 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); |
| 1284 | 1284 |
| 1285 launched_listener.Reply("restart"); | 1285 launched_listener.Reply("restart"); |
| 1286 ExtensionTestMessageListener restart_requested_listener("restartRequested", | 1286 ExtensionTestMessageListener restart_requested_listener("restartRequested", |
| 1287 false); | 1287 false); |
| 1288 ASSERT_TRUE(restart_requested_listener.WaitUntilSatisfied()); | 1288 ASSERT_TRUE(restart_requested_listener.WaitUntilSatisfied()); |
| 1289 | 1289 |
| 1290 EXPECT_EQ(1, request_restart_call_count()); | 1290 EXPECT_EQ(1, num_request_restart_calls()); |
| 1291 } | 1291 } |
| 1292 | 1292 |
| 1293 #endif // defined(OS_CHROMEOS) | 1293 #endif // defined(OS_CHROMEOS) |
| 1294 | 1294 |
| 1295 | 1295 |
| 1296 } // namespace extensions | 1296 } // namespace extensions |
| OLD | NEW |