OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extensions/test_extension_prefs.h" | 5 #include "chrome/browser/extensions/test_extension_prefs.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 pref_service_->SavePersistentPrefs(); | 73 pref_service_->SavePersistentPrefs(); |
74 EXPECT_TRUE(BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 74 EXPECT_TRUE(BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
75 new SignalingTask(&io_finished))); | 75 new SignalingTask(&io_finished))); |
76 | 76 |
77 // If the FILE thread is in fact the current thread (possible in testing | 77 // If the FILE thread is in fact the current thread (possible in testing |
78 // scenarios), we have to ensure the task has a chance to run. If the FILE | 78 // scenarios), we have to ensure the task has a chance to run. If the FILE |
79 // thread is a different thread, the test must ensure that thread is running | 79 // thread is a different thread, the test must ensure that thread is running |
80 // (otherwise the Wait below will hang). | 80 // (otherwise the Wait below will hang). |
81 MessageLoop::current()->RunAllPending(); | 81 MessageLoop::current()->RunAllPending(); |
82 | 82 |
83 EXPECT_TRUE(io_finished.Wait()); | 83 io_finished.Wait(); |
84 } | 84 } |
85 | 85 |
86 extension_pref_value_map_.reset(new ExtensionPrefValueMap); | 86 extension_pref_value_map_.reset(new ExtensionPrefValueMap); |
87 PrefServiceMockBuilder builder; | 87 PrefServiceMockBuilder builder; |
88 builder.WithUserFilePrefs(preferences_file_); | 88 builder.WithUserFilePrefs(preferences_file_); |
89 builder.WithExtensionPrefs( | 89 builder.WithExtensionPrefs( |
90 new ExtensionPrefStore(extension_pref_value_map_.get(), false)); | 90 new ExtensionPrefStore(extension_pref_value_map_.get(), false)); |
91 pref_service_.reset(builder.Create()); | 91 pref_service_.reset(builder.Create()); |
92 ExtensionPrefs::RegisterUserPrefs(pref_service_.get()); | 92 ExtensionPrefs::RegisterUserPrefs(pref_service_.get()); |
93 | 93 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 } | 147 } |
148 | 148 |
149 PrefService* TestExtensionPrefs::CreateIncognitoPrefService() const { | 149 PrefService* TestExtensionPrefs::CreateIncognitoPrefService() const { |
150 return pref_service_->CreateIncognitoPrefService( | 150 return pref_service_->CreateIncognitoPrefService( |
151 new ExtensionPrefStore(extension_pref_value_map_.get(), true)); | 151 new ExtensionPrefStore(extension_pref_value_map_.get(), true)); |
152 } | 152 } |
153 | 153 |
154 void TestExtensionPrefs::set_extensions_disabled(bool extensions_disabled) { | 154 void TestExtensionPrefs::set_extensions_disabled(bool extensions_disabled) { |
155 extensions_disabled_ = extensions_disabled; | 155 extensions_disabled_ = extensions_disabled; |
156 } | 156 } |
OLD | NEW |