| 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" |
| 11 #include "base/synchronization/waitable_event.h" | 11 #include "base/synchronization/waitable_event.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "chrome/browser/extensions/extension_pref_store.h" | 13 #include "chrome/browser/extensions/extension_pref_store.h" |
| 14 #include "chrome/browser/extensions/extension_pref_value_map.h" | 14 #include "chrome/browser/extensions/extension_pref_value_map.h" |
| 15 #include "chrome/browser/extensions/extension_prefs.h" | 15 #include "chrome/browser/extensions/extension_prefs.h" |
| 16 #include "chrome/browser/prefs/pref_service.h" | 16 #include "chrome/browser/prefs/pref_service.h" |
| 17 #include "chrome/browser/prefs/pref_service_mock_builder.h" | 17 #include "chrome/browser/prefs/pref_service_mock_builder.h" |
| 18 #include "chrome/browser/prefs/pref_value_store.h" | 18 #include "chrome/browser/prefs/pref_value_store.h" |
| 19 #include "chrome/common/extensions/extension.h" | 19 #include "chrome/common/extensions/extension.h" |
| 20 #include "chrome/common/extensions/extension_constants.h" | 20 #include "chrome/common/extensions/extension_constants.h" |
| 21 #include "chrome/common/json_pref_store.h" | 21 #include "chrome/common/json_pref_store.h" |
| 22 #include "chrome/test/base/signaling_task.h" | 22 #include "chrome/test/base/signaling_task.h" |
| 23 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 25 | 25 |
| 26 using content::BrowserThread; |
| 27 |
| 26 namespace { | 28 namespace { |
| 27 | 29 |
| 28 // Mock ExtensionPrefs class with artificial clock to guarantee that no two | 30 // Mock ExtensionPrefs class with artificial clock to guarantee that no two |
| 29 // extensions get the same installation time stamp and we can reliably | 31 // extensions get the same installation time stamp and we can reliably |
| 30 // assert the installation order in the tests below. | 32 // assert the installation order in the tests below. |
| 31 class MockExtensionPrefs : public ExtensionPrefs { | 33 class MockExtensionPrefs : public ExtensionPrefs { |
| 32 public: | 34 public: |
| 33 MockExtensionPrefs(PrefService* prefs, | 35 MockExtensionPrefs(PrefService* prefs, |
| 34 const FilePath& root_dir, | 36 const FilePath& root_dir, |
| 35 ExtensionPrefValueMap* extension_pref_value_map) | 37 ExtensionPrefValueMap* extension_pref_value_map) |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 } | 149 } |
| 148 | 150 |
| 149 PrefService* TestExtensionPrefs::CreateIncognitoPrefService() const { | 151 PrefService* TestExtensionPrefs::CreateIncognitoPrefService() const { |
| 150 return pref_service_->CreateIncognitoPrefService( | 152 return pref_service_->CreateIncognitoPrefService( |
| 151 new ExtensionPrefStore(extension_pref_value_map_.get(), true)); | 153 new ExtensionPrefStore(extension_pref_value_map_.get(), true)); |
| 152 } | 154 } |
| 153 | 155 |
| 154 void TestExtensionPrefs::set_extensions_disabled(bool extensions_disabled) { | 156 void TestExtensionPrefs::set_extensions_disabled(bool extensions_disabled) { |
| 155 extensions_disabled_ = extensions_disabled; | 157 extensions_disabled_ = extensions_disabled; |
| 156 } | 158 } |
| OLD | NEW |