| 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 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1040 return state; | 1040 return state; |
| 1041 } | 1041 } |
| 1042 | 1042 |
| 1043 class JsonPrefStoreCallbackTest : public JsonPrefStoreTest { | 1043 class JsonPrefStoreCallbackTest : public JsonPrefStoreTest { |
| 1044 public: | 1044 public: |
| 1045 JsonPrefStoreCallbackTest() = default; | 1045 JsonPrefStoreCallbackTest() = default; |
| 1046 | 1046 |
| 1047 protected: | 1047 protected: |
| 1048 void SetUp() override { | 1048 void SetUp() override { |
| 1049 JsonPrefStoreTest::SetUp(); | 1049 JsonPrefStoreTest::SetUp(); |
| 1050 test_file_ = temp_dir_.path().AppendASCII("test.json"); | 1050 test_file_ = temp_dir_.GetPath().AppendASCII("test.json"); |
| 1051 } | 1051 } |
| 1052 | 1052 |
| 1053 scoped_refptr<JsonPrefStore> CreatePrefStore() { | 1053 scoped_refptr<JsonPrefStore> CreatePrefStore() { |
| 1054 return new JsonPrefStore(test_file_, message_loop_.task_runner(), | 1054 return new JsonPrefStore(test_file_, message_loop_.task_runner(), |
| 1055 std::unique_ptr<PrefFilter>()); | 1055 std::unique_ptr<PrefFilter>()); |
| 1056 } | 1056 } |
| 1057 | 1057 |
| 1058 // Return the ImportantFileWriter for a given JsonPrefStore. | 1058 // Return the ImportantFileWriter for a given JsonPrefStore. |
| 1059 ImportantFileWriter* GetImportantFileWriter(JsonPrefStore* pref_store) { | 1059 ImportantFileWriter* GetImportantFileWriter(JsonPrefStore* pref_store) { |
| 1060 return &(pref_store->writer_); | 1060 return &(pref_store->writer_); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 write_callback_observer_.ObserveNextWriteCallback( | 1169 write_callback_observer_.ObserveNextWriteCallback( |
| 1170 soon_out_of_scope_pref_store.get()); | 1170 soon_out_of_scope_pref_store.get()); |
| 1171 file_writer->WriteNow(MakeUnique<std::string>("foo")); | 1171 file_writer->WriteNow(MakeUnique<std::string>("foo")); |
| 1172 } | 1172 } |
| 1173 RunLoop().RunUntilIdle(); | 1173 RunLoop().RunUntilIdle(); |
| 1174 EXPECT_FALSE(successful_write_reply_observer_.GetAndResetObservationState()); | 1174 EXPECT_FALSE(successful_write_reply_observer_.GetAndResetObservationState()); |
| 1175 EXPECT_EQ(CALLED_WITH_SUCCESS, | 1175 EXPECT_EQ(CALLED_WITH_SUCCESS, |
| 1176 write_callback_observer_.GetAndResetObservationState()); | 1176 write_callback_observer_.GetAndResetObservationState()); |
| 1177 } | 1177 } |
| 1178 | 1178 |
| 1179 } // namespace base | 1179 } // namespace base |
| OLD | NEW |