OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 12 matching lines...) Expand all Loading... |
23 virtual void SetUp() { | 23 virtual void SetUp() { |
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(PrefService::CreatePrefService(temp_file, NULL)); | 33 local_state_.reset(PrefService::CreatePrefService(temp_file, NULL, NULL)); |
34 ASSERT_TRUE(NULL != local_state_.get()); | 34 ASSERT_TRUE(NULL != local_state_.get()); |
35 SignedSettingsTempStorage::RegisterPrefs(local_state_.get()); | 35 SignedSettingsTempStorage::RegisterPrefs(local_state_.get()); |
36 } | 36 } |
37 | 37 |
38 std::map<std::string, std::string> ref_map_; | 38 std::map<std::string, std::string> ref_map_; |
39 ScopedTempDir temp_dir_; | 39 ScopedTempDir temp_dir_; |
40 scoped_ptr<PrefService> local_state_; | 40 scoped_ptr<PrefService> local_state_; |
41 }; | 41 }; |
42 | 42 |
43 TEST_F(SignedSettingsTempStorageTest, Basic) { | 43 TEST_F(SignedSettingsTempStorageTest, Basic) { |
(...skipping 23 matching lines...) Expand all Loading... |
67 EXPECT_TRUE(SignedSettingsTempStorage::Retrieve(b_list[i]->first, &value, | 67 EXPECT_TRUE(SignedSettingsTempStorage::Retrieve(b_list[i]->first, &value, |
68 local_state_.get())); | 68 local_state_.get())); |
69 EXPECT_EQ(b_list[i]->second, value); | 69 EXPECT_EQ(b_list[i]->second, value); |
70 EXPECT_FALSE(SignedSettingsTempStorage::Retrieve("non-existent tv-series", | 70 EXPECT_FALSE(SignedSettingsTempStorage::Retrieve("non-existent tv-series", |
71 &value, | 71 &value, |
72 local_state_.get())); | 72 local_state_.get())); |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
76 } // namespace chromeos | 76 } // namespace chromeos |
OLD | NEW |