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/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" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "base/metrics/histogram_samples.h" | 14 #include "base/metrics/histogram_samples.h" |
15 #include "base/metrics/statistics_recorder.h" | 15 #include "base/metrics/statistics_recorder.h" |
16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
17 #include "base/prefs/pref_filter.h" | 17 #include "base/prefs/pref_filter.h" |
18 #include "base/run_loop.h" | 18 #include "base/run_loop.h" |
19 #include "base/single_thread_task_runner.h" | 19 #include "base/single_thread_task_runner.h" |
20 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
22 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
23 #include "base/test/simple_test_clock.h" | 23 #include "base/test/simple_test_clock.h" |
24 #include "base/threading/sequenced_worker_pool.h" | 24 #include "base/threading/sequenced_worker_pool.h" |
25 #include "base/threading/thread.h" | 25 #include "base/threading/thread.h" |
26 #include "base/values.h" | 26 #include "base/values.h" |
27 #include "testing/gmock/include/gmock/gmock.h" | 27 #include "testing/gtest/googlemock/include/gmock/gmock.h" |
28 #include "testing/gtest/include/gtest/gtest.h" | 28 #include "testing/gtest/googletest/include/gtest/gtest.h" |
29 | 29 |
30 namespace base { | 30 namespace base { |
31 namespace { | 31 namespace { |
32 | 32 |
33 const char kHomePage[] = "homepage"; | 33 const char kHomePage[] = "homepage"; |
34 | 34 |
35 // Set the time on the given SimpleTestClock to the given time in minutes. | 35 // Set the time on the given SimpleTestClock to the given time in minutes. |
36 void SetCurrentTimeInMinutes(double minutes, base::SimpleTestClock* clock) { | 36 void SetCurrentTimeInMinutes(double minutes, base::SimpleTestClock* clock) { |
37 const int32_t kBaseTimeMins = 100; | 37 const int32_t kBaseTimeMins = 100; |
38 clock->SetNow(base::Time::FromDoubleT((kBaseTimeMins + minutes) * 60)); | 38 clock->SetNow(base::Time::FromDoubleT((kBaseTimeMins + minutes) * 60)); |
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
949 ASSERT_TRUE(file_writer->HasPendingWrite()); | 949 ASSERT_TRUE(file_writer->HasPendingWrite()); |
950 | 950 |
951 // 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 |
952 // last value set above. | 952 // last value set above. |
953 pref_store->CommitPendingWrite(); | 953 pref_store->CommitPendingWrite(); |
954 ASSERT_FALSE(file_writer->HasPendingWrite()); | 954 ASSERT_FALSE(file_writer->HasPendingWrite()); |
955 ASSERT_EQ("{\"lossy\":\"lossy\"}", GetTestFileContents()); | 955 ASSERT_EQ("{\"lossy\":\"lossy\"}", GetTestFileContents()); |
956 } | 956 } |
957 | 957 |
958 } // namespace base | 958 } // namespace base |
OLD | NEW |