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 "chrome/browser/chromeos/policy/cloud_external_data_policy_observer.h" | 5 #include "chrome/browser/chromeos/policy/cloud_external_data_policy_observer.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 void ConstructAvatarPolicy(const std::string& file_name, | 75 void ConstructAvatarPolicy(const std::string& file_name, |
76 const std::string& url, | 76 const std::string& url, |
77 std::string* policy_data, | 77 std::string* policy_data, |
78 std::string* policy) { | 78 std::string* policy) { |
79 base::FilePath test_data_dir; | 79 base::FilePath test_data_dir; |
80 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir)); | 80 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir)); |
81 ASSERT_TRUE(base::ReadFileToString( | 81 ASSERT_TRUE(base::ReadFileToString( |
82 test_data_dir.Append("chromeos").Append(file_name), | 82 test_data_dir.Append("chromeos").Append(file_name), |
83 policy_data)); | 83 policy_data)); |
84 base::JSONWriter::Write( | 84 base::JSONWriter::Write( |
85 test::ConstructExternalDataReference(url, *policy_data).get(), | 85 *test::ConstructExternalDataReference(url, *policy_data), policy); |
86 policy); | |
87 } | 86 } |
88 | 87 |
89 } // namespace | 88 } // namespace |
90 | 89 |
91 class CloudExternalDataPolicyObserverTest | 90 class CloudExternalDataPolicyObserverTest |
92 : public chromeos::DeviceSettingsTestBase, | 91 : public chromeos::DeviceSettingsTestBase, |
93 public CloudExternalDataPolicyObserver::Delegate { | 92 public CloudExternalDataPolicyObserver::Delegate { |
94 public: | 93 public: |
95 typedef std::pair<std::string, std::string> FetchedCall; | 94 typedef std::pair<std::string, std::string> FetchedCall; |
96 | 95 |
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 | 949 |
951 EXPECT_TRUE(set_calls_.empty()); | 950 EXPECT_TRUE(set_calls_.empty()); |
952 EXPECT_TRUE(cleared_calls_.empty()); | 951 EXPECT_TRUE(cleared_calls_.empty()); |
953 ASSERT_EQ(1u, fetched_calls_.size()); | 952 ASSERT_EQ(1u, fetched_calls_.size()); |
954 EXPECT_EQ(kRegularUserID, fetched_calls_.front().first); | 953 EXPECT_EQ(kRegularUserID, fetched_calls_.front().first); |
955 EXPECT_EQ(avatar_policy_2_data_, fetched_calls_.front().second); | 954 EXPECT_EQ(avatar_policy_2_data_, fetched_calls_.front().second); |
956 ClearObservations(); | 955 ClearObservations(); |
957 } | 956 } |
958 | 957 |
959 } // namespace policy | 958 } // namespace policy |
OLD | NEW |