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

Unified Diff: chrome/browser/chromeos/login/signed_settings_temp_storage_unittest.cc

Issue 8091002: PART2: Make SignedSettings use proper Value types instead of string all around the place. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased on ToT and made clang happy. Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/signed_settings_temp_storage_unittest.cc
diff --git a/chrome/browser/chromeos/login/signed_settings_temp_storage_unittest.cc b/chrome/browser/chromeos/login/signed_settings_temp_storage_unittest.cc
index 6bcefaac3f39788214ab68432823b27a394aaf59..d6f366eb2af6043e3fe3e2ee983eb1fbeebc9c09 100644
--- a/chrome/browser/chromeos/login/signed_settings_temp_storage_unittest.cc
+++ b/chrome/browser/chromeos/login/signed_settings_temp_storage_unittest.cc
@@ -21,10 +21,11 @@ namespace chromeos {
class SignedSettingsTempStorageTest : public testing::Test {
protected:
virtual void SetUp() {
- ref_map_["some_stuff"] = "a=35;code=64";
- ref_map_["another_stuff"] = "";
- ref_map_["name"] = "value";
- ref_map_["2bc6aa16-e0ea-11df-b13d-18a90520e2e5"] = "512";
+ ref_map_.Set("some_stuff", new base::StringValue("a=35;code=64"));
Mattias Nissler (ping if slow) 2011/10/07 11:02:57 You should rather use Value::CreateStringValue() (
pastarmovj 2011/10/13 11:25:06 Done.
+ ref_map_.Set("another_stuff", new base::FundamentalValue(false));
+ ref_map_.Set("name", new base::StringValue("value"));
+ ref_map_.Set("2bc6aa16-e0ea-11df-b13d-18a90520e2e5",
+ new base::FundamentalValue("512"));
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
FilePath temp_file;
@@ -36,16 +37,18 @@ class SignedSettingsTempStorageTest : public testing::Test {
SignedSettingsTempStorage::RegisterPrefs(local_state_.get());
}
- std::map<std::string, std::string> ref_map_;
+ base::DictionaryValue ref_map_;
+ //std::map<std::string, std::string> ref_map_;
Mattias Nissler (ping if slow) 2011/10/07 11:02:57 remove.
pastarmovj 2011/10/13 11:25:06 Done. P.S This file will be changed heavily when
ScopedTempDir temp_dir_;
scoped_ptr<PrefService> local_state_;
};
TEST_F(SignedSettingsTempStorageTest, Basic) {
EXPECT_GT(ref_map_.size(), 3u); // Number above 3 is many.
- typedef std::map<std::string, std::string>::iterator It;
+ typedef base::DictionaryValue::key_iterator It;
std::vector<It> a_list;
- for (It it = ref_map_.begin(); it != ref_map_.end(); ++it) {
+ base::Value* value;
+ for (It it = ref_map_.begin_keys(); it != ref_map_.end_keys(); ++it) {
a_list.push_back(it);
}
std::random_shuffle(a_list.begin(), a_list.end());
@@ -55,19 +58,21 @@ TEST_F(SignedSettingsTempStorageTest, Basic) {
std::back_inserter(a_list));
std::random_shuffle(a_list.begin(), a_list.end());
for (size_t i = 0; i < a_list.size(); ++i) {
- EXPECT_TRUE(SignedSettingsTempStorage::Store(a_list[i]->first,
- a_list[i]->second,
+ ref_map_.Get(*a_list[i], &value);
+ EXPECT_TRUE(SignedSettingsTempStorage::Store(*a_list[i],
+ *value,
local_state_.get()));
}
for (int i = 0; i < 3; ++i) {
std::copy(a_list.begin(), a_list.end(), std::back_inserter(b_list));
}
std::random_shuffle(b_list.begin(), b_list.end());
- std::string value;
for (size_t i = 0; i < b_list.size(); ++i) {
- EXPECT_TRUE(SignedSettingsTempStorage::Retrieve(b_list[i]->first, &value,
+ EXPECT_TRUE(SignedSettingsTempStorage::Retrieve(*b_list[i], &value,
local_state_.get()));
- EXPECT_EQ(b_list[i]->second, value);
+ base::Value* orignal_value;
+ ref_map_.Get(*b_list[i], &orignal_value);
+ EXPECT_TRUE(orignal_value->Equals(value));
EXPECT_FALSE(SignedSettingsTempStorage::Retrieve("non-existent tv-series",
&value,
local_state_.get()));

Powered by Google App Engine
This is Rietveld 408576698