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

Side by Side Diff: components/prefs/json_pref_store_unittest.cc

Issue 2476493003: Remove FundamentalValue
Patch Set: Fix Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "components/prefs/json_pref_store.h" 5 #include "components/prefs/json_pref_store.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 EXPECT_TRUE(actual->GetAsString(&path)); 235 EXPECT_TRUE(actual->GetAsString(&path));
236 EXPECT_EQ(some_path.value(), path); 236 EXPECT_EQ(some_path.value(), path);
237 237
238 // Test reading some other data types from sub-dictionaries. 238 // Test reading some other data types from sub-dictionaries.
239 EXPECT_TRUE(pref_store->GetValue(kNewWindowsInTabs, &actual)); 239 EXPECT_TRUE(pref_store->GetValue(kNewWindowsInTabs, &actual));
240 bool boolean = false; 240 bool boolean = false;
241 EXPECT_TRUE(actual->GetAsBoolean(&boolean)); 241 EXPECT_TRUE(actual->GetAsBoolean(&boolean));
242 EXPECT_TRUE(boolean); 242 EXPECT_TRUE(boolean);
243 243
244 pref_store->SetValue(kNewWindowsInTabs, 244 pref_store->SetValue(kNewWindowsInTabs,
245 base::MakeUnique<FundamentalValue>(false), 245 base::MakeUnique<Value>(false),
246 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 246 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
247 EXPECT_TRUE(pref_store->GetValue(kNewWindowsInTabs, &actual)); 247 EXPECT_TRUE(pref_store->GetValue(kNewWindowsInTabs, &actual));
248 EXPECT_TRUE(actual->GetAsBoolean(&boolean)); 248 EXPECT_TRUE(actual->GetAsBoolean(&boolean));
249 EXPECT_FALSE(boolean); 249 EXPECT_FALSE(boolean);
250 250
251 EXPECT_TRUE(pref_store->GetValue(kMaxTabs, &actual)); 251 EXPECT_TRUE(pref_store->GetValue(kMaxTabs, &actual));
252 int integer = 0; 252 int integer = 0;
253 EXPECT_TRUE(actual->GetAsInteger(&integer)); 253 EXPECT_TRUE(actual->GetAsInteger(&integer));
254 EXPECT_EQ(20, integer); 254 EXPECT_EQ(20, integer);
255 pref_store->SetValue(kMaxTabs, base::MakeUnique<FundamentalValue>(10), 255 pref_store->SetValue(kMaxTabs, base::MakeUnique<Value>(10),
256 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 256 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
257 EXPECT_TRUE(pref_store->GetValue(kMaxTabs, &actual)); 257 EXPECT_TRUE(pref_store->GetValue(kMaxTabs, &actual));
258 EXPECT_TRUE(actual->GetAsInteger(&integer)); 258 EXPECT_TRUE(actual->GetAsInteger(&integer));
259 EXPECT_EQ(10, integer); 259 EXPECT_EQ(10, integer);
260 260
261 pref_store->SetValue(kLongIntPref, base::MakeUnique<StringValue>( 261 pref_store->SetValue(kLongIntPref, base::MakeUnique<StringValue>(
262 base::Int64ToString(214748364842LL)), 262 base::Int64ToString(214748364842LL)),
263 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 263 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
264 EXPECT_TRUE(pref_store->GetValue(kLongIntPref, &actual)); 264 EXPECT_TRUE(pref_store->GetValue(kLongIntPref, &actual));
265 EXPECT_TRUE(actual->GetAsString(&string_value)); 265 EXPECT_TRUE(actual->GetAsString(&string_value));
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 file_writer->WriteNow(MakeUnique<std::string>("foo")); 1245 file_writer->WriteNow(MakeUnique<std::string>("foo"));
1246 } 1246 }
1247 RunLoop().RunUntilIdle(); 1247 RunLoop().RunUntilIdle();
1248 EXPECT_FALSE(successful_write_reply_observer_.GetAndResetObservationState()); 1248 EXPECT_FALSE(successful_write_reply_observer_.GetAndResetObservationState());
1249 EXPECT_TRUE(write_callback_observer_.GetAndResetPreWriteObservationState()); 1249 EXPECT_TRUE(write_callback_observer_.GetAndResetPreWriteObservationState());
1250 EXPECT_EQ(CALLED_WITH_SUCCESS, 1250 EXPECT_EQ(CALLED_WITH_SUCCESS,
1251 write_callback_observer_.GetAndResetPostWriteObservationState()); 1251 write_callback_observer_.GetAndResetPostWriteObservationState());
1252 } 1252 }
1253 1253
1254 } // namespace base 1254 } // namespace base
OLDNEW
« no previous file with comments | « components/prefs/in_memory_pref_store_unittest.cc ('k') | components/prefs/overlay_user_pref_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698