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 "chrome/browser/prefs/pref_service_mock_builder.h" | 5 #include "chrome/browser/prefs/pref_service_mock_builder.h" |
6 | 6 |
7 #include "base/message_loop_proxy.h" | 7 #include "base/message_loop_proxy.h" |
8 #include "chrome/browser/policy/configuration_policy_pref_store.h" | 8 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
9 #include "chrome/browser/prefs/command_line_pref_store.h" | 9 #include "chrome/browser/prefs/command_line_pref_store.h" |
10 #include "chrome/browser/prefs/default_pref_store.h" | 10 #include "chrome/browser/prefs/default_pref_store.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 #endif | 70 #endif |
71 | 71 |
72 PrefServiceMockBuilder& | 72 PrefServiceMockBuilder& |
73 PrefServiceMockBuilder::WithCommandLine(CommandLine* command_line) { | 73 PrefServiceMockBuilder::WithCommandLine(CommandLine* command_line) { |
74 command_line_prefs_ = new CommandLinePrefStore(command_line); | 74 command_line_prefs_ = new CommandLinePrefStore(command_line); |
75 return *this; | 75 return *this; |
76 } | 76 } |
77 | 77 |
78 PrefServiceMockBuilder& | 78 PrefServiceMockBuilder& |
79 PrefServiceMockBuilder::WithUserFilePrefs(const FilePath& prefs_file) { | 79 PrefServiceMockBuilder::WithUserFilePrefs(const FilePath& prefs_file) { |
80 return WithUserFilePrefs(prefs_file, | 80 return WithUserFilePrefs( |
81 BrowserThread::GetMessageLoopProxyForThread( | 81 prefs_file, |
82 BrowserThread::FILE)); | 82 JsonPrefStore::GetTaskRunnerForFile(prefs_file, |
83 BrowserThread::GetBlockingPool())); | |
83 } | 84 } |
84 | 85 |
85 PrefServiceMockBuilder& | 86 PrefServiceMockBuilder& |
86 PrefServiceMockBuilder::WithUserFilePrefs( | 87 PrefServiceMockBuilder::WithUserFilePrefs( |
87 const FilePath& prefs_file, | 88 const FilePath& prefs_file, |
88 base::MessageLoopProxy* message_loop_proxy) { | 89 base::SequencedTaskRunner* task_runner) { |
89 user_prefs_ = new JsonPrefStore(prefs_file, message_loop_proxy); | 90 user_prefs_ = JsonPrefStore::Create( |
91 prefs_file, | |
akalin
2012/10/19 02:00:51
can these two lines fit on the previous lien?
zel
2012/10/19 18:45:07
Done.
| |
92 task_runner); | |
90 return *this; | 93 return *this; |
91 } | 94 } |
92 | 95 |
93 PrefService* PrefServiceMockBuilder::Create() { | 96 PrefService* PrefServiceMockBuilder::Create() { |
94 DefaultPrefStore* default_pref_store = new DefaultPrefStore(); | 97 DefaultPrefStore* default_pref_store = new DefaultPrefStore(); |
95 PrefNotifierImpl* pref_notifier = new PrefNotifierImpl(); | 98 PrefNotifierImpl* pref_notifier = new PrefNotifierImpl(); |
96 PrefService* pref_service = | 99 PrefService* pref_service = |
97 new PrefService( | 100 new PrefService( |
98 pref_notifier, | 101 pref_notifier, |
99 new PrefValueStore( | 102 new PrefValueStore( |
(...skipping 10 matching lines...) Expand all Loading... | |
110 NULL, | 113 NULL, |
111 false); | 114 false); |
112 managed_prefs_ = NULL; | 115 managed_prefs_ = NULL; |
113 extension_prefs_ = NULL; | 116 extension_prefs_ = NULL; |
114 command_line_prefs_ = NULL; | 117 command_line_prefs_ = NULL; |
115 user_prefs_ = NULL; | 118 user_prefs_ = NULL; |
116 recommended_prefs_ = NULL; | 119 recommended_prefs_ = NULL; |
117 user_prefs_ = new TestingPrefStore; | 120 user_prefs_ = new TestingPrefStore; |
118 return pref_service; | 121 return pref_service; |
119 } | 122 } |
OLD | NEW |