| 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 "base/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/prefs/json_pref_store.h" |
| 11 #include "base/scoped_temp_dir.h" | 12 #include "base/scoped_temp_dir.h" |
| 12 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
| 13 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 14 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
| 15 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
| 16 #include "base/values.h" | 17 #include "base/values.h" |
| 17 #include "chrome/common/chrome_paths.h" | 18 #include "chrome/common/chrome_paths.h" |
| 18 #include "chrome/common/json_pref_store.h" | |
| 19 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
| 20 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 class MockPrefStoreObserver : public PrefStore::Observer { | 25 class MockPrefStoreObserver : public PrefStore::Observer { |
| 26 public: | 26 public: |
| 27 MOCK_METHOD1(OnPrefValueChanged, void (const std::string&)); | 27 MOCK_METHOD1(OnPrefValueChanged, void (const std::string&)); |
| 28 MOCK_METHOD1(OnInitializationCompleted, void (bool)); | 28 MOCK_METHOD1(OnInitializationCompleted, void (bool)); |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 // Write to file. | 284 // Write to file. |
| 285 pref_store->CommitPendingWrite(); | 285 pref_store->CommitPendingWrite(); |
| 286 MessageLoop::current()->RunAllPending(); | 286 MessageLoop::current()->RunAllPending(); |
| 287 | 287 |
| 288 // Compare to expected output. | 288 // Compare to expected output. |
| 289 FilePath golden_output_file = | 289 FilePath golden_output_file = |
| 290 data_dir_.AppendASCII("write.golden.need_empty_value.json"); | 290 data_dir_.AppendASCII("write.golden.need_empty_value.json"); |
| 291 ASSERT_TRUE(file_util::PathExists(golden_output_file)); | 291 ASSERT_TRUE(file_util::PathExists(golden_output_file)); |
| 292 EXPECT_TRUE(file_util::TextContentsEqual(golden_output_file, pref_file)); | 292 EXPECT_TRUE(file_util::TextContentsEqual(golden_output_file, pref_file)); |
| 293 } | 293 } |
| OLD | NEW |