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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 virtual void SetUpOnMainThread() OVERRIDE; | 144 virtual void SetUpOnMainThread() OVERRIDE; |
145 | 145 |
146 DISALLOW_COPY_AND_ASSIGN(PowerPolicyInSessionBrowserTest); | 146 DISALLOW_COPY_AND_ASSIGN(PowerPolicyInSessionBrowserTest); |
147 }; | 147 }; |
148 | 148 |
149 PowerPolicyBrowserTestBase::PowerPolicyBrowserTestBase() | 149 PowerPolicyBrowserTestBase::PowerPolicyBrowserTestBase() |
150 : power_manager_client_(NULL) { | 150 : power_manager_client_(NULL) { |
151 } | 151 } |
152 | 152 |
153 void PowerPolicyBrowserTestBase::SetUpInProcessBrowserTestFixture() { | 153 void PowerPolicyBrowserTestBase::SetUpInProcessBrowserTestFixture() { |
| 154 power_manager_client_ = new chromeos::FakePowerManagerClient; |
| 155 fake_dbus_thread_manager()->SetPowerManagerClient( |
| 156 scoped_ptr<chromeos::PowerManagerClient>(power_manager_client_)); |
| 157 |
154 DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture(); | 158 DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture(); |
155 | 159 |
156 // Initialize device policy. | 160 // Initialize device policy. |
157 InstallOwnerKey(); | 161 InstallOwnerKey(); |
158 MarkAsEnterpriseOwned(); | 162 MarkAsEnterpriseOwned(); |
159 | |
160 power_manager_client_ = | |
161 fake_dbus_thread_manager()->fake_power_manager_client(); | |
162 } | 163 } |
163 | 164 |
164 void PowerPolicyBrowserTestBase::SetUpOnMainThread() { | 165 void PowerPolicyBrowserTestBase::SetUpOnMainThread() { |
165 DevicePolicyCrosBrowserTest::SetUpOnMainThread(); | 166 DevicePolicyCrosBrowserTest::SetUpOnMainThread(); |
166 | 167 |
167 // Initialize user policy. | 168 // Initialize user policy. |
168 InstallUserKey(); | 169 InstallUserKey(); |
169 user_policy_.policy_data().set_username(chromeos::UserManager::kStubUser); | 170 user_policy_.policy_data().set_username(chromeos::UserManager::kStubUser); |
170 } | 171 } |
171 | 172 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 policy.set_ac_idle_action( | 423 policy.set_ac_idle_action( |
423 power_manager_client_->get_policy().ac_idle_action()); | 424 power_manager_client_->get_policy().ac_idle_action()); |
424 policy.set_battery_idle_action( | 425 policy.set_battery_idle_action( |
425 power_manager_client_->get_policy().battery_idle_action()); | 426 power_manager_client_->get_policy().battery_idle_action()); |
426 policy.set_reason(power_manager_client_->get_policy().reason()); | 427 policy.set_reason(power_manager_client_->get_policy().reason()); |
427 EXPECT_EQ(GetDebugString(policy), | 428 EXPECT_EQ(GetDebugString(policy), |
428 GetDebugString(power_manager_client_->get_policy())); | 429 GetDebugString(power_manager_client_->get_policy())); |
429 } | 430 } |
430 | 431 |
431 } // namespace policy | 432 } // namespace policy |
OLD | NEW |