| 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 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/extensions/api/power/power_api_manager.h" | 10 #include "chrome/browser/extensions/api/power/power_api_manager.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 .WillRepeatedly(SaveArg<0>(&last_power_management_policy_)); | 71 .WillRepeatedly(SaveArg<0>(&last_power_management_policy_)); |
| 72 | 72 |
| 73 // Ignore uninteresting calls. | 73 // Ignore uninteresting calls. |
| 74 EXPECT_CALL(*power_manager_client_, AddObserver(_)) | 74 EXPECT_CALL(*power_manager_client_, AddObserver(_)) |
| 75 .Times(AnyNumber()); | 75 .Times(AnyNumber()); |
| 76 EXPECT_CALL(*power_manager_client_, RemoveObserver(_)) | 76 EXPECT_CALL(*power_manager_client_, RemoveObserver(_)) |
| 77 .Times(AnyNumber()); | 77 .Times(AnyNumber()); |
| 78 | 78 |
| 79 chromeos::DBusThreadManager::InitializeForTesting(dbus_thread_manager); | 79 chromeos::DBusThreadManager::InitializeForTesting(dbus_thread_manager); |
| 80 EXPECT_CALL(*dbus_thread_manager->mock_session_manager_client(), | 80 EXPECT_CALL(*dbus_thread_manager->mock_session_manager_client(), |
| 81 RetrieveUserPolicy(_)); | 81 RetrievePolicyForUser(_, _)); |
| 82 EXPECT_CALL(provider_, IsInitializationComplete(_)) | 82 EXPECT_CALL(provider_, IsInitializationComplete(_)) |
| 83 .WillRepeatedly(Return(true)); | 83 .WillRepeatedly(Return(true)); |
| 84 EXPECT_CALL(provider_, RegisterPolicyDomain(_, _)).Times(AnyNumber()); | 84 EXPECT_CALL(provider_, RegisterPolicyDomain(_, _)).Times(AnyNumber()); |
| 85 BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); | 85 BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void PowerPolicyBrowserTest::SetUserPolicy( | 88 void PowerPolicyBrowserTest::SetUserPolicy( |
| 89 const std::string& user_policy_name, | 89 const std::string& user_policy_name, |
| 90 base::Value* user_policy_value) { | 90 base::Value* user_policy_value) { |
| 91 PolicyMap policy_map; | 91 PolicyMap policy_map; |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 SetUserPolicy(key::kAllowScreenWakeLocks, | 241 SetUserPolicy(key::kAllowScreenWakeLocks, |
| 242 base::Value::CreateBooleanValue(false)); | 242 base::Value::CreateBooleanValue(false)); |
| 243 policy = baseline_policy; | 243 policy = baseline_policy; |
| 244 policy.set_idle_action(last_power_management_policy_.idle_action()); | 244 policy.set_idle_action(last_power_management_policy_.idle_action()); |
| 245 policy.set_reason(last_power_management_policy_.reason()); | 245 policy.set_reason(last_power_management_policy_.reason()); |
| 246 EXPECT_EQ(GetDebugString(policy), | 246 EXPECT_EQ(GetDebugString(policy), |
| 247 GetDebugString(last_power_management_policy_)); | 247 GetDebugString(last_power_management_policy_)); |
| 248 } | 248 } |
| 249 | 249 |
| 250 } // namespace policy | 250 } // namespace policy |
| OLD | NEW |