Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: chrome/browser/chromeos/policy/power_policy_browsertest.cc

Issue 2606773002: Setup Chromad user policy plumbing (Closed)
Patch Set: Rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/files/file_util.h" 15 #include "base/files/file_util.h"
16 #include "base/location.h" 16 #include "base/location.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/numerics/safe_conversions.h" 18 #include "base/numerics/safe_conversions.h"
19 #include "base/path_service.h" 19 #include "base/path_service.h"
20 #include "base/run_loop.h" 20 #include "base/run_loop.h"
21 #include "base/single_thread_task_runner.h" 21 #include "base/single_thread_task_runner.h"
22 #include "base/threading/thread_task_runner_handle.h" 22 #include "base/threading/thread_task_runner_handle.h"
23 #include "chrome/browser/chrome_notification_types.h" 23 #include "chrome/browser/chrome_notification_types.h"
24 #include "chrome/browser/chromeos/policy/device_policy_builder.h" 24 #include "chrome/browser/chromeos/policy/device_policy_builder.h"
25 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" 25 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h"
26 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" 26 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h"
27 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" 27 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
28 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h" 28 #include "chrome/browser/chromeos/policy/user_policy_manager_factory_chromeos.h"
29 #include "chrome/browser/chromeos/profiles/profile_helper.h" 29 #include "chrome/browser/chromeos/profiles/profile_helper.h"
30 #include "chrome/browser/lifetime/application_lifetime.h" 30 #include "chrome/browser/lifetime/application_lifetime.h"
31 #include "chrome/browser/policy/profile_policy_connector.h" 31 #include "chrome/browser/policy/profile_policy_connector.h"
32 #include "chrome/browser/policy/profile_policy_connector_factory.h" 32 #include "chrome/browser/policy/profile_policy_connector_factory.h"
33 #include "chrome/browser/profiles/profile.h" 33 #include "chrome/browser/profiles/profile.h"
34 #include "chrome/browser/profiles/profile_manager.h" 34 #include "chrome/browser/profiles/profile_manager.h"
35 #include "chrome/browser/ui/browser.h" 35 #include "chrome/browser/ui/browser.h"
36 #include "chrome/test/base/testing_profile.h" 36 #include "chrome/test/base/testing_profile.h"
37 #include "chromeos/chromeos_paths.h" 37 #include "chromeos/chromeos_paths.h"
38 #include "chromeos/chromeos_switches.h" 38 #include "chromeos/chromeos_switches.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 ->policy_service(); 268 ->policy_service();
269 ASSERT_TRUE(policy_service); 269 ASSERT_TRUE(policy_service);
270 policy_service->AddObserver(POLICY_DOMAIN_CHROME, &observer); 270 policy_service->AddObserver(POLICY_DOMAIN_CHROME, &observer);
271 closure.Run(); 271 closure.Run();
272 run_loop.Run(); 272 run_loop.Run();
273 policy_service->RemoveObserver(POLICY_DOMAIN_CHROME, &observer); 273 policy_service->RemoveObserver(POLICY_DOMAIN_CHROME, &observer);
274 } 274 }
275 275
276 void PowerPolicyBrowserTestBase::ReloadUserPolicy(Profile* profile) { 276 void PowerPolicyBrowserTestBase::ReloadUserPolicy(Profile* profile) {
277 UserCloudPolicyManagerChromeOS* policy_manager = 277 UserCloudPolicyManagerChromeOS* policy_manager =
278 UserCloudPolicyManagerFactoryChromeOS::GetForProfile(profile); 278 UserPolicyManagerFactoryChromeOS::GetCloudPolicyManagerForProfile(
279 profile);
279 ASSERT_TRUE(policy_manager); 280 ASSERT_TRUE(policy_manager);
280 policy_manager->core()->store()->Load(); 281 policy_manager->core()->store()->Load();
281 } 282 }
282 283
283 PowerPolicyLoginScreenBrowserTest::PowerPolicyLoginScreenBrowserTest() { 284 PowerPolicyLoginScreenBrowserTest::PowerPolicyLoginScreenBrowserTest() {
284 } 285 }
285 286
286 void PowerPolicyLoginScreenBrowserTest::SetUpCommandLine( 287 void PowerPolicyLoginScreenBrowserTest::SetUpCommandLine(
287 base::CommandLine* command_line) { 288 base::CommandLine* command_line) {
288 PowerPolicyBrowserTestBase::SetUpCommandLine(command_line); 289 PowerPolicyBrowserTestBase::SetUpCommandLine(command_line);
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 policy = baseline_policy; 514 policy = baseline_policy;
514 policy.set_ac_idle_action(power_manager_client_->policy().ac_idle_action()); 515 policy.set_ac_idle_action(power_manager_client_->policy().ac_idle_action());
515 policy.set_battery_idle_action( 516 policy.set_battery_idle_action(
516 power_manager_client_->policy().battery_idle_action()); 517 power_manager_client_->policy().battery_idle_action());
517 policy.set_reason(power_manager_client_->policy().reason()); 518 policy.set_reason(power_manager_client_->policy().reason());
518 EXPECT_EQ(GetDebugString(policy), 519 EXPECT_EQ(GetDebugString(policy),
519 GetDebugString(power_manager_client_->policy())); 520 GetDebugString(power_manager_client_->policy()));
520 } 521 }
521 522
522 } // namespace policy 523 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698