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

Side by Side Diff: chrome/browser/chromeos/policy/user_cloud_external_data_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/path_service.h" 13 #include "base/path_service.h"
14 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 #include "chrome/browser/chromeos/policy/cloud_external_data_manager_base.h" 17 #include "chrome/browser/chromeos/policy/cloud_external_data_manager_base.h"
18 #include "chrome/browser/chromeos/policy/cloud_external_data_manager_base_test_u til.h" 18 #include "chrome/browser/chromeos/policy/cloud_external_data_manager_base_test_u til.h"
19 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" 19 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
20 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h" 20 #include "chrome/browser/chromeos/policy/user_policy_manager_factory_chromeos.h"
21 #include "chrome/browser/policy/profile_policy_connector.h" 21 #include "chrome/browser/policy/profile_policy_connector.h"
22 #include "chrome/browser/policy/profile_policy_connector_factory.h" 22 #include "chrome/browser/policy/profile_policy_connector_factory.h"
23 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/browser/ui/browser.h" 24 #include "chrome/browser/ui/browser.h"
25 #include "chrome/common/chrome_paths.h" 25 #include "chrome/common/chrome_paths.h"
26 #include "chrome/test/base/in_process_browser_test.h" 26 #include "chrome/test/base/in_process_browser_test.h"
27 #include "components/policy/core/common/cloud/cloud_policy_core.h" 27 #include "components/policy/core/common/cloud/cloud_policy_core.h"
28 #include "components/policy/core/common/external_data_fetcher.h" 28 #include "components/policy/core/common/external_data_fetcher.h"
29 #include "components/policy/core/common/policy_map.h" 29 #include "components/policy/core/common/policy_map.h"
30 #include "components/policy/core/common/policy_service.h" 30 #include "components/policy/core/common/policy_service.h"
(...skipping 24 matching lines...) Expand all
55 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); 55 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir));
56 std::string external_data; 56 std::string external_data;
57 ASSERT_TRUE(base::ReadFileToString(test_dir.AppendASCII(kExternalDataPath), 57 ASSERT_TRUE(base::ReadFileToString(test_dir.AppendASCII(kExternalDataPath),
58 &external_data)); 58 &external_data));
59 ASSERT_FALSE(external_data.empty()); 59 ASSERT_FALSE(external_data.empty());
60 60
61 std::unique_ptr<base::DictionaryValue> metadata = 61 std::unique_ptr<base::DictionaryValue> metadata =
62 test::ConstructExternalDataReference(url.spec(), external_data); 62 test::ConstructExternalDataReference(url.spec(), external_data);
63 #if defined(OS_CHROMEOS) 63 #if defined(OS_CHROMEOS)
64 UserCloudPolicyManagerChromeOS* policy_manager = 64 UserCloudPolicyManagerChromeOS* policy_manager =
65 UserCloudPolicyManagerFactoryChromeOS::GetForProfile( 65 UserPolicyManagerFactoryChromeOS::GetCloudPolicyManagerForProfile(
66 browser()->profile()); 66 browser()->profile());
67 #else 67 #else
68 UserCloudPolicyManager* policy_manager = 68 UserCloudPolicyManager* policy_manager =
69 UserCloudPolicyManagerFactory::GetForBrowserContext(browser()->profile()); 69 UserCloudPolicyManagerFactory::GetForBrowserContext(browser()->profile());
70 #endif 70 #endif
71 ASSERT_TRUE(policy_manager); 71 ASSERT_TRUE(policy_manager);
72 // TODO(bartfab): The test injects an ExternalDataFetcher for an arbitrary 72 // TODO(bartfab): The test injects an ExternalDataFetcher for an arbitrary
73 // policy. This is only done because there are no policies that reference 73 // policy. This is only done because there are no policies that reference
74 // external data yet. Once the first such policy is added, switch the test to 74 // external data yet. Once the first such policy is added, switch the test to
75 // that policy and stop injecting a manually instantiated ExternalDataFetcher. 75 // that policy and stop injecting a manually instantiated ExternalDataFetcher.
(...skipping 17 matching lines...) Expand all
93 &test::ExternalDataFetchCallback, 93 &test::ExternalDataFetchCallback,
94 &fetched_external_data, 94 &fetched_external_data,
95 run_loop.QuitClosure())); 95 run_loop.QuitClosure()));
96 run_loop.Run(); 96 run_loop.Run();
97 97
98 ASSERT_TRUE(fetched_external_data); 98 ASSERT_TRUE(fetched_external_data);
99 EXPECT_EQ(external_data, *fetched_external_data); 99 EXPECT_EQ(external_data, *fetched_external_data);
100 } 100 }
101 101
102 } // namespace policy 102 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698