OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 DISALLOW_COPY_AND_ASSIGN(PowerPolicyBrowserTestBase); | 150 DISALLOW_COPY_AND_ASSIGN(PowerPolicyBrowserTestBase); |
151 }; | 151 }; |
152 | 152 |
153 class PowerPolicyLoginScreenBrowserTest : public PowerPolicyBrowserTestBase { | 153 class PowerPolicyLoginScreenBrowserTest : public PowerPolicyBrowserTestBase { |
154 protected: | 154 protected: |
155 PowerPolicyLoginScreenBrowserTest(); | 155 PowerPolicyLoginScreenBrowserTest(); |
156 | 156 |
157 // PowerPolicyBrowserTestBase: | 157 // PowerPolicyBrowserTestBase: |
158 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; | 158 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; |
159 virtual void SetUpOnMainThread() OVERRIDE; | 159 virtual void SetUpOnMainThread() OVERRIDE; |
160 virtual void CleanUpOnMainThread() OVERRIDE; | 160 virtual void TearDownOnMainThread() OVERRIDE; |
161 | 161 |
162 DISALLOW_COPY_AND_ASSIGN(PowerPolicyLoginScreenBrowserTest); | 162 DISALLOW_COPY_AND_ASSIGN(PowerPolicyLoginScreenBrowserTest); |
163 }; | 163 }; |
164 | 164 |
165 class PowerPolicyInSessionBrowserTest : public PowerPolicyBrowserTestBase { | 165 class PowerPolicyInSessionBrowserTest : public PowerPolicyBrowserTestBase { |
166 protected: | 166 protected: |
167 PowerPolicyInSessionBrowserTest(); | 167 PowerPolicyInSessionBrowserTest(); |
168 | 168 |
169 // PowerPolicyBrowserTestBase: | 169 // PowerPolicyBrowserTestBase: |
170 virtual void SetUpOnMainThread() OVERRIDE; | 170 virtual void SetUpOnMainThread() OVERRIDE; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 284 |
285 void PowerPolicyLoginScreenBrowserTest::SetUpOnMainThread() { | 285 void PowerPolicyLoginScreenBrowserTest::SetUpOnMainThread() { |
286 PowerPolicyBrowserTestBase::SetUpOnMainThread(); | 286 PowerPolicyBrowserTestBase::SetUpOnMainThread(); |
287 | 287 |
288 // Wait for the login screen to be shown. | 288 // Wait for the login screen to be shown. |
289 content::WindowedNotificationObserver( | 289 content::WindowedNotificationObserver( |
290 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, | 290 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, |
291 content::NotificationService::AllSources()).Wait(); | 291 content::NotificationService::AllSources()).Wait(); |
292 } | 292 } |
293 | 293 |
294 void PowerPolicyLoginScreenBrowserTest::CleanUpOnMainThread() { | 294 void PowerPolicyLoginScreenBrowserTest::TearDownOnMainThread() { |
295 base::MessageLoop::current()->PostTask(FROM_HERE, | 295 base::MessageLoop::current()->PostTask(FROM_HERE, |
296 base::Bind(&chrome::AttemptExit)); | 296 base::Bind(&chrome::AttemptExit)); |
297 base::RunLoop().RunUntilIdle(); | 297 base::RunLoop().RunUntilIdle(); |
298 PowerPolicyBrowserTestBase::CleanUpOnMainThread(); | 298 PowerPolicyBrowserTestBase::TearDownOnMainThread(); |
299 } | 299 } |
300 | 300 |
301 PowerPolicyInSessionBrowserTest::PowerPolicyInSessionBrowserTest() { | 301 PowerPolicyInSessionBrowserTest::PowerPolicyInSessionBrowserTest() { |
302 } | 302 } |
303 | 303 |
304 void PowerPolicyInSessionBrowserTest::SetUpOnMainThread() { | 304 void PowerPolicyInSessionBrowserTest::SetUpOnMainThread() { |
305 PowerPolicyBrowserTestBase::SetUpOnMainThread(); | 305 PowerPolicyBrowserTestBase::SetUpOnMainThread(); |
306 } | 306 } |
307 | 307 |
308 // Verifies that device policy is applied on the login screen. | 308 // Verifies that device policy is applied on the login screen. |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 policy = baseline_policy; | 505 policy = baseline_policy; |
506 policy.set_ac_idle_action(power_manager_client_->policy().ac_idle_action()); | 506 policy.set_ac_idle_action(power_manager_client_->policy().ac_idle_action()); |
507 policy.set_battery_idle_action( | 507 policy.set_battery_idle_action( |
508 power_manager_client_->policy().battery_idle_action()); | 508 power_manager_client_->policy().battery_idle_action()); |
509 policy.set_reason(power_manager_client_->policy().reason()); | 509 policy.set_reason(power_manager_client_->policy().reason()); |
510 EXPECT_EQ(GetDebugString(policy), | 510 EXPECT_EQ(GetDebugString(policy), |
511 GetDebugString(power_manager_client_->policy())); | 511 GetDebugString(power_manager_client_->policy())); |
512 } | 512 } |
513 | 513 |
514 } // namespace policy | 514 } // namespace policy |
OLD | NEW |