Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: chrome/browser/ui/cocoa/extensions/extension_popup_controller_unittest.mm

Issue 7977018: Enable sync for the settings from the Extension Settings API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix race condition in ExtensionSettingsUIWrapper::Core Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/util/cryptographer.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/memory/scoped_nsobject.h" 5 #include "base/memory/scoped_nsobject.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "chrome/browser/extensions/extension_pref_value_map.h" 8 #include "chrome/browser/extensions/extension_pref_value_map.h"
9 #include "chrome/browser/extensions/extension_prefs.h" 9 #include "chrome/browser/extensions/extension_prefs.h"
10 #include "chrome/browser/extensions/extension_process_manager.h" 10 #include "chrome/browser/extensions/extension_process_manager.h"
11 #include "chrome/browser/extensions/extension_service.h" 11 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/extensions/extension_settings.h"
13 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" 13 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h"
15 #include "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" 14 #include "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h"
16 #include "chrome/test/base/testing_profile.h" 15 #include "chrome/test/base/testing_profile.h"
17 16
18 namespace { 17 namespace {
19 18
20 class ExtensionTestingProfile : public TestingProfile { 19 class ExtensionTestingProfile : public TestingProfile {
21 public: 20 public:
22 ExtensionTestingProfile() {} 21 ExtensionTestingProfile() {}
23 22
24 FilePath GetExtensionsInstallDir() { 23 FilePath GetExtensionsInstallDir() {
25 return GetPath().AppendASCII(ExtensionService::kInstallDirectoryName); 24 return GetPath().AppendASCII(ExtensionService::kInstallDirectoryName);
26 } 25 }
27 26
28 FilePath GetExtensionsSettingsDir() { 27 FilePath GetExtensionsSettingsDir() {
29 return GetPath().AppendASCII(ExtensionService::kSettingsDirectoryName); 28 return GetPath().AppendASCII(ExtensionService::kSettingsDirectoryName);
30 } 29 }
31 30
32 void InitExtensionProfile() { 31 void InitExtensionProfile() {
33 DCHECK(!GetExtensionProcessManager()); 32 DCHECK(!GetExtensionProcessManager());
34 DCHECK(!GetExtensionService()); 33 DCHECK(!GetExtensionService());
35 34
36 manager_.reset(ExtensionProcessManager::Create(this)); 35 manager_.reset(ExtensionProcessManager::Create(this));
37 extension_pref_value_map_.reset(new ExtensionPrefValueMap); 36 extension_pref_value_map_.reset(new ExtensionPrefValueMap);
38 extension_prefs_.reset(new ExtensionPrefs(GetPrefs(), 37 extension_prefs_.reset(new ExtensionPrefs(GetPrefs(),
39 GetExtensionsInstallDir(), 38 GetExtensionsInstallDir(),
40 extension_pref_value_map_.get())); 39 extension_pref_value_map_.get()));
41 extension_settings_ = new ExtensionSettings(GetExtensionsSettingsDir());
42 service_.reset(new ExtensionService(this, 40 service_.reset(new ExtensionService(this,
43 CommandLine::ForCurrentProcess(), 41 CommandLine::ForCurrentProcess(),
44 GetExtensionsInstallDir(), 42 GetExtensionsInstallDir(),
45 extension_prefs_.get(), 43 extension_prefs_.get(),
46 extension_settings_.get(),
47 false, 44 false,
48 true)); 45 true));
49 service_->set_extensions_enabled(true); 46 service_->set_extensions_enabled(true);
50 service_->set_show_extensions_prompts(false); 47 service_->set_show_extensions_prompts(false);
51 service_->ClearProvidersForTesting(); 48 service_->ClearProvidersForTesting();
52 service_->Init(); 49 service_->Init();
53 } 50 }
54 51
55 void ShutdownExtensionProfile() { 52 void ShutdownExtensionProfile() {
56 manager_.reset(); 53 manager_.reset();
57 service_.reset(); 54 service_.reset();
58 extension_prefs_.reset(); 55 extension_prefs_.reset();
59 extension_settings_ = NULL;
60 } 56 }
61 57
62 virtual ExtensionProcessManager* GetExtensionProcessManager() { 58 virtual ExtensionProcessManager* GetExtensionProcessManager() {
63 return manager_.get(); 59 return manager_.get();
64 } 60 }
65 61
66 virtual ExtensionService* GetExtensionService() { 62 virtual ExtensionService* GetExtensionService() {
67 return service_.get(); 63 return service_.get();
68 } 64 }
69 65
70 private: 66 private:
71 scoped_ptr<ExtensionProcessManager> manager_; 67 scoped_ptr<ExtensionProcessManager> manager_;
72 scoped_ptr<ExtensionPrefs> extension_prefs_; 68 scoped_ptr<ExtensionPrefs> extension_prefs_;
73 scoped_refptr<ExtensionSettings> extension_settings_;
74 scoped_ptr<ExtensionService> service_; 69 scoped_ptr<ExtensionService> service_;
75 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_; 70 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_;
76 71
77 DISALLOW_COPY_AND_ASSIGN(ExtensionTestingProfile); 72 DISALLOW_COPY_AND_ASSIGN(ExtensionTestingProfile);
78 }; 73 };
79 74
80 class ExtensionPopupControllerTest : public CocoaTest { 75 class ExtensionPopupControllerTest : public CocoaTest {
81 public: 76 public:
82 virtual void SetUp() { 77 virtual void SetUp() {
83 CocoaTest::SetUp(); 78 CocoaTest::SetUp();
(...skipping 18 matching lines...) Expand all
102 }; 97 };
103 98
104 TEST_F(ExtensionPopupControllerTest, DISABLED_Basics) { 99 TEST_F(ExtensionPopupControllerTest, DISABLED_Basics) {
105 // TODO(andybons): Better mechanisms for mocking out the extensions service 100 // TODO(andybons): Better mechanisms for mocking out the extensions service
106 // and extensions for easy testing need to be implemented. 101 // and extensions for easy testing need to be implemented.
107 // http://crbug.com/28316 102 // http://crbug.com/28316
108 EXPECT_TRUE([ExtensionPopupController popup]); 103 EXPECT_TRUE([ExtensionPopupController popup]);
109 } 104 }
110 105
111 } // namespace 106 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/sync/util/cryptographer.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698