| OLD | NEW |
| 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" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 UserCloudPolicyManagerFactoryChromeOS::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 Loading... |
| 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 |
| OLD | NEW |