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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
9 #include "base/prefs/default_pref_store.h" | 9 #include "base/prefs/default_pref_store.h" |
10 #include "base/prefs/json_pref_store.h" | 10 #include "base/prefs/json_pref_store.h" |
11 #include "base/prefs/testing_pref_store.h" | 11 #include "base/prefs/testing_pref_store.h" |
12 #include "chrome/browser/policy/configuration_policy_pref_store.h" | 12 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
13 #include "chrome/browser/prefs/command_line_pref_store.h" | 13 #include "chrome/browser/prefs/command_line_pref_store.h" |
14 #include "chrome/browser/prefs/pref_notifier_impl.h" | 14 #include "chrome/browser/prefs/pref_notifier_impl.h" |
15 #include "chrome/browser/prefs/pref_service.h" | 15 #include "chrome/browser/prefs/pref_service.h" |
16 #include "chrome/browser/prefs/pref_value_store.h" | 16 #include "chrome/browser/prefs/pref_value_store.h" |
17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
18 #include "ui/base/l10n/l10n_util.h" | |
19 | 18 |
20 using content::BrowserThread; | 19 using content::BrowserThread; |
21 | 20 |
22 PrefServiceMockBuilder::PrefServiceMockBuilder() { | 21 PrefServiceMockBuilder::PrefServiceMockBuilder() { |
23 ResetTestingState(); | 22 ResetTestingState(); |
24 } | 23 } |
25 | 24 |
26 PrefServiceMockBuilder::~PrefServiceMockBuilder() {} | 25 PrefServiceMockBuilder::~PrefServiceMockBuilder() {} |
27 | 26 |
28 #if defined(ENABLE_CONFIGURATION_POLICY) | 27 #if defined(ENABLE_CONFIGURATION_POLICY) |
(...skipping 11 matching lines...) Expand all Loading... |
40 return *this; | 39 return *this; |
41 } | 40 } |
42 #endif | 41 #endif |
43 | 42 |
44 PrefServiceMockBuilder& | 43 PrefServiceMockBuilder& |
45 PrefServiceMockBuilder::WithCommandLine(CommandLine* command_line) { | 44 PrefServiceMockBuilder::WithCommandLine(CommandLine* command_line) { |
46 WithCommandLinePrefs(new CommandLinePrefStore(command_line)); | 45 WithCommandLinePrefs(new CommandLinePrefStore(command_line)); |
47 return *this; | 46 return *this; |
48 } | 47 } |
49 | 48 |
50 PrefService* PrefServiceMockBuilder::Create() { | 49 PrefServiceSimple* PrefServiceMockBuilder::CreateSimple() { |
51 PrefService* pref_service = PrefServiceBuilder::Create(); | 50 PrefServiceSimple* service = new PrefServiceSimple; |
| 51 PrefServiceBuilder::Build(service); |
52 ResetTestingState(); | 52 ResetTestingState(); |
53 return pref_service; | 53 return service; |
| 54 } |
| 55 |
| 56 PrefServiceSyncable* PrefServiceMockBuilder::CreateSyncable() { |
| 57 PrefServiceSyncable* service = new PrefServiceSyncable; |
| 58 PrefServiceBuilder::Build(service); |
| 59 ResetTestingState(); |
| 60 return service; |
54 } | 61 } |
55 | 62 |
56 void PrefServiceMockBuilder::ResetTestingState() { | 63 void PrefServiceMockBuilder::ResetTestingState() { |
57 user_prefs_ = new TestingPrefStore; | 64 user_prefs_ = new TestingPrefStore; |
58 } | 65 } |
OLD | NEW |