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

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

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 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 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 "base/prefs/json_pref_store.h" 5 #include "base/prefs/json_pref_store.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 EXPECT_EQ(cnn, string_value); 185 EXPECT_EQ(cnn, string_value);
186 186
187 const char kSomeDirectory[] = "some_directory"; 187 const char kSomeDirectory[] = "some_directory";
188 188
189 EXPECT_TRUE(pref_store->GetValue(kSomeDirectory, &actual)); 189 EXPECT_TRUE(pref_store->GetValue(kSomeDirectory, &actual));
190 base::FilePath::StringType path; 190 base::FilePath::StringType path;
191 EXPECT_TRUE(actual->GetAsString(&path)); 191 EXPECT_TRUE(actual->GetAsString(&path));
192 EXPECT_EQ(base::FilePath::StringType(FILE_PATH_LITERAL("/usr/local/")), path); 192 EXPECT_EQ(base::FilePath::StringType(FILE_PATH_LITERAL("/usr/local/")), path);
193 base::FilePath some_path(FILE_PATH_LITERAL("/usr/sbin/")); 193 base::FilePath some_path(FILE_PATH_LITERAL("/usr/sbin/"));
194 194
195 pref_store->SetValue(kSomeDirectory, new StringValue(some_path.value()), 195 pref_store->SetValue(kSomeDirectory,
196 make_scoped_ptr(new StringValue(some_path.value())),
196 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 197 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
197 EXPECT_TRUE(pref_store->GetValue(kSomeDirectory, &actual)); 198 EXPECT_TRUE(pref_store->GetValue(kSomeDirectory, &actual));
198 EXPECT_TRUE(actual->GetAsString(&path)); 199 EXPECT_TRUE(actual->GetAsString(&path));
199 EXPECT_EQ(some_path.value(), path); 200 EXPECT_EQ(some_path.value(), path);
200 201
201 // Test reading some other data types from sub-dictionaries. 202 // Test reading some other data types from sub-dictionaries.
202 EXPECT_TRUE(pref_store->GetValue(kNewWindowsInTabs, &actual)); 203 EXPECT_TRUE(pref_store->GetValue(kNewWindowsInTabs, &actual));
203 bool boolean = false; 204 bool boolean = false;
204 EXPECT_TRUE(actual->GetAsBoolean(&boolean)); 205 EXPECT_TRUE(actual->GetAsBoolean(&boolean));
205 EXPECT_TRUE(boolean); 206 EXPECT_TRUE(boolean);
206 207
207 pref_store->SetValue(kNewWindowsInTabs, new FundamentalValue(false), 208 pref_store->SetValue(kNewWindowsInTabs,
209 make_scoped_ptr(new FundamentalValue(false)),
208 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 210 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
209 EXPECT_TRUE(pref_store->GetValue(kNewWindowsInTabs, &actual)); 211 EXPECT_TRUE(pref_store->GetValue(kNewWindowsInTabs, &actual));
210 EXPECT_TRUE(actual->GetAsBoolean(&boolean)); 212 EXPECT_TRUE(actual->GetAsBoolean(&boolean));
211 EXPECT_FALSE(boolean); 213 EXPECT_FALSE(boolean);
212 214
213 EXPECT_TRUE(pref_store->GetValue(kMaxTabs, &actual)); 215 EXPECT_TRUE(pref_store->GetValue(kMaxTabs, &actual));
214 int integer = 0; 216 int integer = 0;
215 EXPECT_TRUE(actual->GetAsInteger(&integer)); 217 EXPECT_TRUE(actual->GetAsInteger(&integer));
216 EXPECT_EQ(20, integer); 218 EXPECT_EQ(20, integer);
217 pref_store->SetValue(kMaxTabs, new FundamentalValue(10), 219 pref_store->SetValue(kMaxTabs, make_scoped_ptr(new FundamentalValue(10)),
218 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 220 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
219 EXPECT_TRUE(pref_store->GetValue(kMaxTabs, &actual)); 221 EXPECT_TRUE(pref_store->GetValue(kMaxTabs, &actual));
220 EXPECT_TRUE(actual->GetAsInteger(&integer)); 222 EXPECT_TRUE(actual->GetAsInteger(&integer));
221 EXPECT_EQ(10, integer); 223 EXPECT_EQ(10, integer);
222 224
223 pref_store->SetValue(kLongIntPref, 225 pref_store->SetValue(
224 new StringValue(base::Int64ToString(214748364842LL)), 226 kLongIntPref,
225 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 227 make_scoped_ptr(new StringValue(base::Int64ToString(214748364842LL))),
228 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
226 EXPECT_TRUE(pref_store->GetValue(kLongIntPref, &actual)); 229 EXPECT_TRUE(pref_store->GetValue(kLongIntPref, &actual));
227 EXPECT_TRUE(actual->GetAsString(&string_value)); 230 EXPECT_TRUE(actual->GetAsString(&string_value));
228 int64 value; 231 int64 value;
229 base::StringToInt64(string_value, &value); 232 base::StringToInt64(string_value, &value);
230 EXPECT_EQ(214748364842LL, value); 233 EXPECT_EQ(214748364842LL, value);
231 234
232 // Serialize and compare to expected output. 235 // Serialize and compare to expected output.
233 ASSERT_TRUE(PathExists(golden_output_file)); 236 ASSERT_TRUE(PathExists(golden_output_file));
234 pref_store->CommitPendingWrite(); 237 pref_store->CommitPendingWrite();
235 RunLoop().RunUntilIdle(); 238 RunLoop().RunUntilIdle();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 pref_store.get(), input_file, data_dir_.AppendASCII("write.golden.json")); 308 pref_store.get(), input_file, data_dir_.AppendASCII("write.golden.json"));
306 } 309 }
307 310
308 TEST_F(JsonPrefStoreTest, PreserveEmptyValues) { 311 TEST_F(JsonPrefStoreTest, PreserveEmptyValues) {
309 FilePath pref_file = temp_dir_.path().AppendASCII("empty_values.json"); 312 FilePath pref_file = temp_dir_.path().AppendASCII("empty_values.json");
310 313
311 scoped_refptr<JsonPrefStore> pref_store = new JsonPrefStore( 314 scoped_refptr<JsonPrefStore> pref_store = new JsonPrefStore(
312 pref_file, message_loop_.task_runner(), scoped_ptr<PrefFilter>()); 315 pref_file, message_loop_.task_runner(), scoped_ptr<PrefFilter>());
313 316
314 // Set some keys with empty values. 317 // Set some keys with empty values.
315 pref_store->SetValue("list", new base::ListValue, 318 pref_store->SetValue("list", make_scoped_ptr(new base::ListValue),
316 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 319 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
317 pref_store->SetValue("dict", new base::DictionaryValue, 320 pref_store->SetValue("dict", make_scoped_ptr(new base::DictionaryValue),
318 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 321 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
319 322
320 // Write to file. 323 // Write to file.
321 pref_store->CommitPendingWrite(); 324 pref_store->CommitPendingWrite();
322 RunLoop().RunUntilIdle(); 325 RunLoop().RunUntilIdle();
323 326
324 // Reload. 327 // Reload.
325 pref_store = new JsonPrefStore(pref_file, message_loop_.task_runner(), 328 pref_store = new JsonPrefStore(pref_file, message_loop_.task_runner(),
326 scoped_ptr<PrefFilter>()); 329 scoped_ptr<PrefFilter>());
327 ASSERT_EQ(PersistentPrefStore::PREF_READ_ERROR_NONE, pref_store->ReadPrefs()); 330 ASSERT_EQ(PersistentPrefStore::PREF_READ_ERROR_NONE, pref_store->ReadPrefs());
328 ASSERT_FALSE(pref_store->ReadOnly()); 331 ASSERT_FALSE(pref_store->ReadOnly());
329 332
330 // Check values. 333 // Check values.
331 const Value* result = NULL; 334 const Value* result = NULL;
332 EXPECT_TRUE(pref_store->GetValue("list", &result)); 335 EXPECT_TRUE(pref_store->GetValue("list", &result));
333 EXPECT_TRUE(ListValue().Equals(result)); 336 EXPECT_TRUE(ListValue().Equals(result));
334 EXPECT_TRUE(pref_store->GetValue("dict", &result)); 337 EXPECT_TRUE(pref_store->GetValue("dict", &result));
335 EXPECT_TRUE(DictionaryValue().Equals(result)); 338 EXPECT_TRUE(DictionaryValue().Equals(result));
336 } 339 }
337 340
338 // This test is just documenting some potentially non-obvious behavior. It 341 // This test is just documenting some potentially non-obvious behavior. It
339 // shouldn't be taken as normative. 342 // shouldn't be taken as normative.
340 TEST_F(JsonPrefStoreTest, RemoveClearsEmptyParent) { 343 TEST_F(JsonPrefStoreTest, RemoveClearsEmptyParent) {
341 FilePath pref_file = temp_dir_.path().AppendASCII("empty_values.json"); 344 FilePath pref_file = temp_dir_.path().AppendASCII("empty_values.json");
342 345
343 scoped_refptr<JsonPrefStore> pref_store = new JsonPrefStore( 346 scoped_refptr<JsonPrefStore> pref_store = new JsonPrefStore(
344 pref_file, message_loop_.task_runner(), scoped_ptr<PrefFilter>()); 347 pref_file, message_loop_.task_runner(), scoped_ptr<PrefFilter>());
345 348
346 base::DictionaryValue* dict = new base::DictionaryValue; 349 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
347 dict->SetString("key", "value"); 350 dict->SetString("key", "value");
348 pref_store->SetValue("dict", dict, 351 pref_store->SetValue("dict", dict.Pass(),
349 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 352 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
350 353
351 pref_store->RemoveValue("dict.key", 354 pref_store->RemoveValue("dict.key",
352 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 355 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
353 356
354 const base::Value* retrieved_dict = NULL; 357 const base::Value* retrieved_dict = NULL;
355 bool has_dict = pref_store->GetValue("dict", &retrieved_dict); 358 bool has_dict = pref_store->GetValue("dict", &retrieved_dict);
356 EXPECT_FALSE(has_dict); 359 EXPECT_FALSE(has_dict);
357 } 360 }
358 361
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 private: 841 private:
839 base::FilePath test_file_; 842 base::FilePath test_file_;
840 }; 843 };
841 844
842 TEST_F(JsonPrefStoreLossyWriteTest, LossyWriteBasic) { 845 TEST_F(JsonPrefStoreLossyWriteTest, LossyWriteBasic) {
843 scoped_refptr<JsonPrefStore> pref_store = CreatePrefStore(); 846 scoped_refptr<JsonPrefStore> pref_store = CreatePrefStore();
844 ImportantFileWriter* file_writer = GetImportantFileWriter(pref_store); 847 ImportantFileWriter* file_writer = GetImportantFileWriter(pref_store);
845 848
846 // Set a normal pref and check that it gets scheduled to be written. 849 // Set a normal pref and check that it gets scheduled to be written.
847 ASSERT_FALSE(file_writer->HasPendingWrite()); 850 ASSERT_FALSE(file_writer->HasPendingWrite());
848 pref_store->SetValue("normal", new base::StringValue("normal"), 851 pref_store->SetValue("normal",
852 make_scoped_ptr(new base::StringValue("normal")),
849 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 853 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
850 ASSERT_TRUE(file_writer->HasPendingWrite()); 854 ASSERT_TRUE(file_writer->HasPendingWrite());
851 file_writer->DoScheduledWrite(); 855 file_writer->DoScheduledWrite();
852 ASSERT_EQ("{\"normal\":\"normal\"}", GetTestFileContents()); 856 ASSERT_EQ("{\"normal\":\"normal\"}", GetTestFileContents());
853 ASSERT_FALSE(file_writer->HasPendingWrite()); 857 ASSERT_FALSE(file_writer->HasPendingWrite());
854 858
855 // Set a lossy pref and check that it is not scheduled to be written. 859 // Set a lossy pref and check that it is not scheduled to be written.
856 // SetValue/RemoveValue. 860 // SetValue/RemoveValue.
857 pref_store->SetValue("lossy", new base::StringValue("lossy"), 861 pref_store->SetValue("lossy", make_scoped_ptr(new base::StringValue("lossy")),
858 WriteablePrefStore::LOSSY_PREF_WRITE_FLAG); 862 WriteablePrefStore::LOSSY_PREF_WRITE_FLAG);
859 ASSERT_FALSE(file_writer->HasPendingWrite()); 863 ASSERT_FALSE(file_writer->HasPendingWrite());
860 pref_store->RemoveValue("lossy", WriteablePrefStore::LOSSY_PREF_WRITE_FLAG); 864 pref_store->RemoveValue("lossy", WriteablePrefStore::LOSSY_PREF_WRITE_FLAG);
861 ASSERT_FALSE(file_writer->HasPendingWrite()); 865 ASSERT_FALSE(file_writer->HasPendingWrite());
862 866
863 // SetValueSilently/RemoveValueSilently. 867 // SetValueSilently/RemoveValueSilently.
864 pref_store->SetValueSilently("lossy", new base::StringValue("lossy"), 868 pref_store->SetValueSilently("lossy",
869 make_scoped_ptr(new base::StringValue("lossy")),
865 WriteablePrefStore::LOSSY_PREF_WRITE_FLAG); 870 WriteablePrefStore::LOSSY_PREF_WRITE_FLAG);
866 ASSERT_FALSE(file_writer->HasPendingWrite()); 871 ASSERT_FALSE(file_writer->HasPendingWrite());
867 pref_store->RemoveValueSilently("lossy", 872 pref_store->RemoveValueSilently("lossy",
868 WriteablePrefStore::LOSSY_PREF_WRITE_FLAG); 873 WriteablePrefStore::LOSSY_PREF_WRITE_FLAG);
869 ASSERT_FALSE(file_writer->HasPendingWrite()); 874 ASSERT_FALSE(file_writer->HasPendingWrite());
870 875
871 // ReportValueChanged. 876 // ReportValueChanged.
872 pref_store->SetValue("lossy", new base::StringValue("lossy"), 877 pref_store->SetValue("lossy", make_scoped_ptr(new base::StringValue("lossy")),
873 WriteablePrefStore::LOSSY_PREF_WRITE_FLAG); 878 WriteablePrefStore::LOSSY_PREF_WRITE_FLAG);
874 ASSERT_FALSE(file_writer->HasPendingWrite()); 879 ASSERT_FALSE(file_writer->HasPendingWrite());
875 pref_store->ReportValueChanged("lossy", 880 pref_store->ReportValueChanged("lossy",
876 WriteablePrefStore::LOSSY_PREF_WRITE_FLAG); 881 WriteablePrefStore::LOSSY_PREF_WRITE_FLAG);
877 ASSERT_FALSE(file_writer->HasPendingWrite()); 882 ASSERT_FALSE(file_writer->HasPendingWrite());
878 883
879 // Call CommitPendingWrite and check that the lossy pref and the normal pref 884 // Call CommitPendingWrite and check that the lossy pref and the normal pref
880 // are there with the last values set above. 885 // are there with the last values set above.
881 pref_store->CommitPendingWrite(); 886 pref_store->CommitPendingWrite();
882 ASSERT_FALSE(file_writer->HasPendingWrite()); 887 ASSERT_FALSE(file_writer->HasPendingWrite());
883 ASSERT_EQ("{\"lossy\":\"lossy\",\"normal\":\"normal\"}", 888 ASSERT_EQ("{\"lossy\":\"lossy\",\"normal\":\"normal\"}",
884 GetTestFileContents()); 889 GetTestFileContents());
885 } 890 }
886 891
887 TEST_F(JsonPrefStoreLossyWriteTest, LossyWriteMixedLossyFirst) { 892 TEST_F(JsonPrefStoreLossyWriteTest, LossyWriteMixedLossyFirst) {
888 scoped_refptr<JsonPrefStore> pref_store = CreatePrefStore(); 893 scoped_refptr<JsonPrefStore> pref_store = CreatePrefStore();
889 ImportantFileWriter* file_writer = GetImportantFileWriter(pref_store); 894 ImportantFileWriter* file_writer = GetImportantFileWriter(pref_store);
890 895
891 // Set a lossy pref and check that it is not scheduled to be written. 896 // Set a lossy pref and check that it is not scheduled to be written.
892 ASSERT_FALSE(file_writer->HasPendingWrite()); 897 ASSERT_FALSE(file_writer->HasPendingWrite());
893 pref_store->SetValue("lossy", new base::StringValue("lossy"), 898 pref_store->SetValue("lossy", make_scoped_ptr(new base::StringValue("lossy")),
894 WriteablePrefStore::LOSSY_PREF_WRITE_FLAG); 899 WriteablePrefStore::LOSSY_PREF_WRITE_FLAG);
895 ASSERT_FALSE(file_writer->HasPendingWrite()); 900 ASSERT_FALSE(file_writer->HasPendingWrite());
896 901
897 // Set a normal pref and check that it is scheduled to be written. 902 // Set a normal pref and check that it is scheduled to be written.
898 pref_store->SetValue("normal", new base::StringValue("normal"), 903 pref_store->SetValue("normal",
904 make_scoped_ptr(new base::StringValue("normal")),
899 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 905 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
900 ASSERT_TRUE(file_writer->HasPendingWrite()); 906 ASSERT_TRUE(file_writer->HasPendingWrite());
901 907
902 // Call DoScheduledWrite and check both prefs get written. 908 // Call DoScheduledWrite and check both prefs get written.
903 file_writer->DoScheduledWrite(); 909 file_writer->DoScheduledWrite();
904 ASSERT_EQ("{\"lossy\":\"lossy\",\"normal\":\"normal\"}", 910 ASSERT_EQ("{\"lossy\":\"lossy\",\"normal\":\"normal\"}",
905 GetTestFileContents()); 911 GetTestFileContents());
906 ASSERT_FALSE(file_writer->HasPendingWrite()); 912 ASSERT_FALSE(file_writer->HasPendingWrite());
907 } 913 }
908 914
909 TEST_F(JsonPrefStoreLossyWriteTest, LossyWriteMixedLossySecond) { 915 TEST_F(JsonPrefStoreLossyWriteTest, LossyWriteMixedLossySecond) {
910 scoped_refptr<JsonPrefStore> pref_store = CreatePrefStore(); 916 scoped_refptr<JsonPrefStore> pref_store = CreatePrefStore();
911 ImportantFileWriter* file_writer = GetImportantFileWriter(pref_store); 917 ImportantFileWriter* file_writer = GetImportantFileWriter(pref_store);
912 918
913 // Set a normal pref and check that it is scheduled to be written. 919 // Set a normal pref and check that it is scheduled to be written.
914 ASSERT_FALSE(file_writer->HasPendingWrite()); 920 ASSERT_FALSE(file_writer->HasPendingWrite());
915 pref_store->SetValue("normal", new base::StringValue("normal"), 921 pref_store->SetValue("normal",
922 make_scoped_ptr(new base::StringValue("normal")),
916 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 923 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
917 ASSERT_TRUE(file_writer->HasPendingWrite()); 924 ASSERT_TRUE(file_writer->HasPendingWrite());
918 925
919 // Set a lossy pref and check that the write is still scheduled. 926 // Set a lossy pref and check that the write is still scheduled.
920 pref_store->SetValue("lossy", new base::StringValue("lossy"), 927 pref_store->SetValue("lossy", make_scoped_ptr(new base::StringValue("lossy")),
921 WriteablePrefStore::LOSSY_PREF_WRITE_FLAG); 928 WriteablePrefStore::LOSSY_PREF_WRITE_FLAG);
922 ASSERT_TRUE(file_writer->HasPendingWrite()); 929 ASSERT_TRUE(file_writer->HasPendingWrite());
923 930
924 // Call DoScheduledWrite and check both prefs get written. 931 // Call DoScheduledWrite and check both prefs get written.
925 file_writer->DoScheduledWrite(); 932 file_writer->DoScheduledWrite();
926 ASSERT_EQ("{\"lossy\":\"lossy\",\"normal\":\"normal\"}", 933 ASSERT_EQ("{\"lossy\":\"lossy\",\"normal\":\"normal\"}",
927 GetTestFileContents()); 934 GetTestFileContents());
928 ASSERT_FALSE(file_writer->HasPendingWrite()); 935 ASSERT_FALSE(file_writer->HasPendingWrite());
929 } 936 }
930 937
931 TEST_F(JsonPrefStoreLossyWriteTest, ScheduleLossyWrite) { 938 TEST_F(JsonPrefStoreLossyWriteTest, ScheduleLossyWrite) {
932 scoped_refptr<JsonPrefStore> pref_store = CreatePrefStore(); 939 scoped_refptr<JsonPrefStore> pref_store = CreatePrefStore();
933 ImportantFileWriter* file_writer = GetImportantFileWriter(pref_store); 940 ImportantFileWriter* file_writer = GetImportantFileWriter(pref_store);
934 941
935 // Set a lossy pref and check that it is not scheduled to be written. 942 // Set a lossy pref and check that it is not scheduled to be written.
936 pref_store->SetValue("lossy", new base::StringValue("lossy"), 943 pref_store->SetValue("lossy", make_scoped_ptr(new base::StringValue("lossy")),
937 WriteablePrefStore::LOSSY_PREF_WRITE_FLAG); 944 WriteablePrefStore::LOSSY_PREF_WRITE_FLAG);
938 ASSERT_FALSE(file_writer->HasPendingWrite()); 945 ASSERT_FALSE(file_writer->HasPendingWrite());
939 946
940 // Schedule pending lossy writes and check that it is scheduled. 947 // Schedule pending lossy writes and check that it is scheduled.
941 pref_store->SchedulePendingLossyWrites(); 948 pref_store->SchedulePendingLossyWrites();
942 ASSERT_TRUE(file_writer->HasPendingWrite()); 949 ASSERT_TRUE(file_writer->HasPendingWrite());
943 950
944 // Call CommitPendingWrite and check that the lossy pref is there with the 951 // Call CommitPendingWrite and check that the lossy pref is there with the
945 // last value set above. 952 // last value set above.
946 pref_store->CommitPendingWrite(); 953 pref_store->CommitPendingWrite();
947 ASSERT_FALSE(file_writer->HasPendingWrite()); 954 ASSERT_FALSE(file_writer->HasPendingWrite());
948 ASSERT_EQ("{\"lossy\":\"lossy\"}", GetTestFileContents()); 955 ASSERT_EQ("{\"lossy\":\"lossy\"}", GetTestFileContents());
949 } 956 }
950 957
951 } // namespace base 958 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698