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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_UNITTEST_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_UNITTEST_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_UNITTEST_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_UNITTEST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/scoped_temp_dir.h" | 12 #include "base/memory/scoped_temp_dir.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
15 #include "content/browser/browser_thread.h" | 15 #include "content/browser/browser_thread.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 class ExtensionServiceTestBase : public testing::Test { | 18 class ExtensionServiceTestBase : public testing::Test { |
19 public: | 19 public: |
20 ExtensionServiceTestBase(); | 20 ExtensionServiceTestBase(); |
21 ~ExtensionServiceTestBase(); | 21 virtual ~ExtensionServiceTestBase(); |
22 | 22 |
23 virtual void InitializeExtensionService( | 23 void InitializeExtensionService( |
24 const FilePath& pref_file, const FilePath& extensions_install_dir); | 24 const FilePath& pref_file, const FilePath& extensions_install_dir, |
| 25 bool autoupdate_enabled); |
25 | 26 |
26 virtual void InitializeInstalledExtensionService( | 27 void InitializeInstalledExtensionService( |
27 const FilePath& prefs_file, const FilePath& source_install_dir); | 28 const FilePath& prefs_file, const FilePath& source_install_dir); |
28 | 29 |
29 virtual void InitializeEmptyExtensionService(); | 30 void InitializeEmptyExtensionService(); |
| 31 |
| 32 void InitializeExtensionServiceWithUpdater(); |
30 | 33 |
31 static void SetUpTestCase(); | 34 static void SetUpTestCase(); |
32 | 35 |
33 virtual void SetUp(); | 36 virtual void SetUp(); |
34 | 37 |
35 void set_extensions_enabled(bool enabled) { | 38 void set_extensions_enabled(bool enabled) { |
36 service_->set_extensions_enabled(enabled); | 39 service_->set_extensions_enabled(enabled); |
37 } | 40 } |
38 | 41 |
39 protected: | 42 protected: |
| 43 void InitializeExtensionServiceHelper(bool autoupdate_enabled); |
| 44 |
40 ScopedTempDir temp_dir_; | 45 ScopedTempDir temp_dir_; |
41 scoped_ptr<Profile> profile_; | 46 scoped_ptr<Profile> profile_; |
42 FilePath extensions_install_dir_; | 47 FilePath extensions_install_dir_; |
43 FilePath data_dir_; | 48 FilePath data_dir_; |
44 scoped_refptr<ExtensionService> service_; | 49 scoped_refptr<ExtensionService> service_; |
45 size_t total_successes_; | 50 size_t total_successes_; |
46 MessageLoop loop_; | 51 MessageLoop loop_; |
47 BrowserThread ui_thread_; | 52 BrowserThread ui_thread_; |
48 BrowserThread db_thread_; | 53 BrowserThread db_thread_; |
49 BrowserThread webkit_thread_; | 54 BrowserThread webkit_thread_; |
50 BrowserThread file_thread_; | 55 BrowserThread file_thread_; |
51 BrowserThread io_thread_; | 56 BrowserThread io_thread_; |
52 }; | 57 }; |
53 | 58 |
54 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_UNITTEST_H_ | 59 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_UNITTEST_H_ |
OLD | NEW |