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

Side by Side Diff: chrome/browser/policy/cloud/cloud_policy_manager_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 <memory> 5 #include <memory>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/policy/cloud/test_request_interceptor.h" 11 #include "chrome/browser/policy/cloud/test_request_interceptor.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
14 #include "chrome/test/base/in_process_browser_test.h" 14 #include "chrome/test/base/in_process_browser_test.h"
15 #include "components/policy/core/browser/browser_policy_connector.h" 15 #include "components/policy/core/browser/browser_policy_connector.h"
16 #include "components/policy/core/common/cloud/cloud_policy_client.h" 16 #include "components/policy/core/common/cloud/cloud_policy_client.h"
17 #include "components/policy/core/common/cloud/device_management_service.h" 17 #include "components/policy/core/common/cloud/device_management_service.h"
18 #include "components/policy/core/common/cloud/mock_cloud_policy_client.h" 18 #include "components/policy/core/common/cloud/mock_cloud_policy_client.h"
19 #include "components/policy/core/common/policy_switches.h" 19 #include "components/policy/core/common/policy_switches.h"
20 #include "components/policy/core/common/policy_test_utils.h" 20 #include "components/policy/core/common/policy_test_utils.h"
21 #include "components/policy/proto/device_management_backend.pb.h" 21 #include "components/policy/proto/device_management_backend.pb.h"
22 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
23 #include "net/base/net_errors.h" 23 #include "net/base/net_errors.h"
24 #include "net/url_request/url_request_context_getter.h" 24 #include "net/url_request/url_request_context_getter.h"
25 #include "testing/gmock/include/gmock/gmock.h" 25 #include "testing/gmock/include/gmock/gmock.h"
26 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
27 27
28 #if defined(OS_CHROMEOS) 28 #if defined(OS_CHROMEOS)
29 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" 29 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
30 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h" 30 #include "chrome/browser/chromeos/policy/user_policy_manager_factory_chromeos.h"
31 #else 31 #else
32 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" 32 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h"
33 #include "chrome/browser/signin/signin_manager_factory.h" 33 #include "chrome/browser/signin/signin_manager_factory.h"
34 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" 34 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h"
35 #include "components/signin/core/browser/signin_manager.h" 35 #include "components/signin/core/browser/signin_manager.h"
36 #endif 36 #endif
37 37
38 using content::BrowserThread; 38 using content::BrowserThread;
39 using testing::AnyNumber; 39 using testing::AnyNumber;
40 using testing::InvokeWithoutArgs; 40 using testing::InvokeWithoutArgs;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 void TearDownOnMainThread() override { 92 void TearDownOnMainThread() override {
93 // Verify that all the expected requests were handled. 93 // Verify that all the expected requests were handled.
94 EXPECT_EQ(0u, interceptor_->GetPendingSize()); 94 EXPECT_EQ(0u, interceptor_->GetPendingSize());
95 95
96 interceptor_.reset(); 96 interceptor_.reset();
97 } 97 }
98 98
99 #if defined(OS_CHROMEOS) 99 #if defined(OS_CHROMEOS)
100 UserCloudPolicyManagerChromeOS* policy_manager() { 100 UserCloudPolicyManagerChromeOS* policy_manager() {
101 return UserCloudPolicyManagerFactoryChromeOS::GetForProfile( 101 return UserPolicyManagerFactoryChromeOS::GetCloudPolicyManagerForProfile(
102 browser()->profile()); 102 browser()->profile());
103 } 103 }
104 #else 104 #else
105 UserCloudPolicyManager* policy_manager() { 105 UserCloudPolicyManager* policy_manager() {
106 return UserCloudPolicyManagerFactory::GetForBrowserContext( 106 return UserCloudPolicyManagerFactory::GetForBrowserContext(
107 browser()->profile()); 107 browser()->profile());
108 } 108 }
109 #endif // defined(OS_CHROMEOS) 109 #endif // defined(OS_CHROMEOS)
110 110
111 // Register the client of the policy_manager() using a bogus auth token, and 111 // Register the client of the policy_manager() using a bogus auth token, and
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 const bool expect_reregister = true; 197 const bool expect_reregister = true;
198 interceptor_->PushJobCallback( 198 interceptor_->PushJobCallback(
199 TestRequestInterceptor::RegisterJob(expected_type, expect_reregister)); 199 TestRequestInterceptor::RegisterJob(expected_type, expect_reregister));
200 200
201 EXPECT_FALSE(policy_manager()->core()->client()->is_registered()); 201 EXPECT_FALSE(policy_manager()->core()->client()->is_registered());
202 ASSERT_NO_FATAL_FAILURE(Register()); 202 ASSERT_NO_FATAL_FAILURE(Register());
203 EXPECT_TRUE(policy_manager()->core()->client()->is_registered()); 203 EXPECT_TRUE(policy_manager()->core()->client()->is_registered());
204 } 204 }
205 205
206 } // namespace policy 206 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698