OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/login/signed_settings_temp_storage.h" | 5 #include "chrome/browser/chromeos/login/signed_settings_temp_storage.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
(...skipping 13 matching lines...) Expand all Loading... |
24 ref_map_["some_stuff"] = "a=35;code=64"; | 24 ref_map_["some_stuff"] = "a=35;code=64"; |
25 ref_map_["another_stuff"] = ""; | 25 ref_map_["another_stuff"] = ""; |
26 ref_map_["name"] = "value"; | 26 ref_map_["name"] = "value"; |
27 ref_map_["2bc6aa16-e0ea-11df-b13d-18a90520e2e5"] = "512"; | 27 ref_map_["2bc6aa16-e0ea-11df-b13d-18a90520e2e5"] = "512"; |
28 | 28 |
29 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 29 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
30 FilePath temp_file; | 30 FilePath temp_file; |
31 ASSERT_TRUE( | 31 ASSERT_TRUE( |
32 file_util::CreateTemporaryFileInDir(temp_dir_.path(), &temp_file)); | 32 file_util::CreateTemporaryFileInDir(temp_dir_.path(), &temp_file)); |
33 local_state_.reset( | 33 local_state_.reset( |
34 PrefService::CreatePrefService(temp_file, NULL, NULL, false)); | 34 PrefService::CreatePrefService(temp_file, NULL, false)); |
35 ASSERT_TRUE(NULL != local_state_.get()); | 35 ASSERT_TRUE(NULL != local_state_.get()); |
36 SignedSettingsTempStorage::RegisterPrefs(local_state_.get()); | 36 SignedSettingsTempStorage::RegisterPrefs(local_state_.get()); |
37 } | 37 } |
38 | 38 |
39 std::map<std::string, std::string> ref_map_; | 39 std::map<std::string, std::string> ref_map_; |
40 ScopedTempDir temp_dir_; | 40 ScopedTempDir temp_dir_; |
41 scoped_ptr<PrefService> local_state_; | 41 scoped_ptr<PrefService> local_state_; |
42 }; | 42 }; |
43 | 43 |
44 TEST_F(SignedSettingsTempStorageTest, Basic) { | 44 TEST_F(SignedSettingsTempStorageTest, Basic) { |
(...skipping 23 matching lines...) Expand all Loading... |
68 EXPECT_TRUE(SignedSettingsTempStorage::Retrieve(b_list[i]->first, &value, | 68 EXPECT_TRUE(SignedSettingsTempStorage::Retrieve(b_list[i]->first, &value, |
69 local_state_.get())); | 69 local_state_.get())); |
70 EXPECT_EQ(b_list[i]->second, value); | 70 EXPECT_EQ(b_list[i]->second, value); |
71 EXPECT_FALSE(SignedSettingsTempStorage::Retrieve("non-existent tv-series", | 71 EXPECT_FALSE(SignedSettingsTempStorage::Retrieve("non-existent tv-series", |
72 &value, | 72 &value, |
73 local_state_.get())); | 73 local_state_.get())); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 } // namespace chromeos | 77 } // namespace chromeos |
OLD | NEW |