| OLD | NEW |
| 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 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 return state; | 1074 return state; |
| 1075 } | 1075 } |
| 1076 | 1076 |
| 1077 class JsonPrefStoreCallbackTest : public JsonPrefStoreTest { | 1077 class JsonPrefStoreCallbackTest : public JsonPrefStoreTest { |
| 1078 public: | 1078 public: |
| 1079 JsonPrefStoreCallbackTest() = default; | 1079 JsonPrefStoreCallbackTest() = default; |
| 1080 | 1080 |
| 1081 protected: | 1081 protected: |
| 1082 void SetUp() override { | 1082 void SetUp() override { |
| 1083 JsonPrefStoreTest::SetUp(); | 1083 JsonPrefStoreTest::SetUp(); |
| 1084 test_file_ = temp_dir_.path().AppendASCII("test.json"); | 1084 test_file_ = temp_dir_.GetPath().AppendASCII("test.json"); |
| 1085 } | 1085 } |
| 1086 | 1086 |
| 1087 scoped_refptr<JsonPrefStore> CreatePrefStore() { | 1087 scoped_refptr<JsonPrefStore> CreatePrefStore() { |
| 1088 return new JsonPrefStore(test_file_, message_loop_.task_runner(), | 1088 return new JsonPrefStore(test_file_, message_loop_.task_runner(), |
| 1089 std::unique_ptr<PrefFilter>()); | 1089 std::unique_ptr<PrefFilter>()); |
| 1090 } | 1090 } |
| 1091 | 1091 |
| 1092 // Return the ImportantFileWriter for a given JsonPrefStore. | 1092 // Return the ImportantFileWriter for a given JsonPrefStore. |
| 1093 ImportantFileWriter* GetImportantFileWriter(JsonPrefStore* pref_store) { | 1093 ImportantFileWriter* GetImportantFileWriter(JsonPrefStore* pref_store) { |
| 1094 return &(pref_store->writer_); | 1094 return &(pref_store->writer_); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1244 soon_out_of_scope_pref_store.get()); | 1244 soon_out_of_scope_pref_store.get()); |
| 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 |
| OLD | NEW |