| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/message_loop.h" | 6 #include "base/message_loop.h" |
| 7 #include "base/message_loop_proxy.h" | 7 #include "base/message_loop_proxy.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/thread.h" | 12 #include "base/threading/thread.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/common/json_pref_store.h" | 15 #include "chrome/common/json_pref_store.h" |
| 16 #include "chrome/common/chrome_paths.h" | 16 #include "chrome/common/chrome_paths.h" |
| 17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 19 |
| 20 class JsonPrefStoreTest : public testing::Test { | 20 class JsonPrefStoreTest : public testing::Test { |
| 21 protected: | 21 protected: |
| 22 virtual void SetUp() { | 22 virtual void SetUp() { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 159 |
| 160 // Serialize and compare to expected output. | 160 // Serialize and compare to expected output. |
| 161 FilePath output_file = input_file; | 161 FilePath output_file = input_file; |
| 162 FilePath golden_output_file = data_dir_.AppendASCII("write.golden.json"); | 162 FilePath golden_output_file = data_dir_.AppendASCII("write.golden.json"); |
| 163 ASSERT_TRUE(file_util::PathExists(golden_output_file)); | 163 ASSERT_TRUE(file_util::PathExists(golden_output_file)); |
| 164 ASSERT_TRUE(pref_store.WritePrefs()); | 164 ASSERT_TRUE(pref_store.WritePrefs()); |
| 165 MessageLoop::current()->RunAllPending(); | 165 MessageLoop::current()->RunAllPending(); |
| 166 EXPECT_TRUE(file_util::TextContentsEqual(golden_output_file, output_file)); | 166 EXPECT_TRUE(file_util::TextContentsEqual(golden_output_file, output_file)); |
| 167 ASSERT_TRUE(file_util::Delete(output_file, false)); | 167 ASSERT_TRUE(file_util::Delete(output_file, false)); |
| 168 } | 168 } |
| OLD | NEW |