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

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

Issue 7189029: Implement an initial extension settings API. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Make clang happy Created 9 years, 4 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/profiles/profile_impl.cc ('k') | chrome/chrome.gyp » ('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/message_loop.h" 6 #include "base/message_loop.h"
7 #include "chrome/browser/extensions/extension_pref_value_map.h" 7 #include "chrome/browser/extensions/extension_pref_value_map.h"
8 #include "chrome/browser/extensions/extension_prefs.h" 8 #include "chrome/browser/extensions/extension_prefs.h"
9 #include "chrome/browser/extensions/extension_process_manager.h" 9 #include "chrome/browser/extensions/extension_process_manager.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
11 #include "chrome/browser/extensions/extension_settings.h"
11 #include "chrome/browser/ui/cocoa/browser_test_helper.h" 12 #include "chrome/browser/ui/cocoa/browser_test_helper.h"
12 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" 13 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h"
13 #include "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" 14 #include "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h"
14 #include "chrome/test/base/testing_profile.h" 15 #include "chrome/test/base/testing_profile.h"
15 16
16 namespace { 17 namespace {
17 18
18 class ExtensionTestingProfile : public TestingProfile { 19 class ExtensionTestingProfile : public TestingProfile {
19 public: 20 public:
20 ExtensionTestingProfile() {} 21 ExtensionTestingProfile() {}
21 22
22 FilePath GetExtensionsInstallDir() { 23 FilePath GetExtensionsInstallDir() {
23 return GetPath().AppendASCII(ExtensionService::kInstallDirectoryName); 24 return GetPath().AppendASCII(ExtensionService::kInstallDirectoryName);
24 } 25 }
25 26
27 FilePath GetExtensionsSettingsDir() {
28 return GetPath().AppendASCII(ExtensionService::kSettingsDirectoryName);
29 }
30
26 void InitExtensionProfile() { 31 void InitExtensionProfile() {
27 DCHECK(!GetExtensionProcessManager()); 32 DCHECK(!GetExtensionProcessManager());
28 DCHECK(!GetExtensionService()); 33 DCHECK(!GetExtensionService());
29 34
30 manager_.reset(ExtensionProcessManager::Create(this)); 35 manager_.reset(ExtensionProcessManager::Create(this));
31 extension_pref_value_map_.reset(new ExtensionPrefValueMap); 36 extension_pref_value_map_.reset(new ExtensionPrefValueMap);
32 extension_prefs_.reset(new ExtensionPrefs(GetPrefs(), 37 extension_prefs_.reset(new ExtensionPrefs(GetPrefs(),
33 GetExtensionsInstallDir(), 38 GetExtensionsInstallDir(),
34 extension_pref_value_map_.get())); 39 extension_pref_value_map_.get()));
40 extension_settings_ = new ExtensionSettings(GetExtensionsSettingsDir());
35 service_.reset(new ExtensionService(this, 41 service_.reset(new ExtensionService(this,
36 CommandLine::ForCurrentProcess(), 42 CommandLine::ForCurrentProcess(),
37 GetExtensionsInstallDir(), 43 GetExtensionsInstallDir(),
38 extension_prefs_.get(), 44 extension_prefs_.get(),
45 extension_settings_.get(),
39 false, 46 false,
40 true)); 47 true));
41 service_->set_extensions_enabled(true); 48 service_->set_extensions_enabled(true);
42 service_->set_show_extensions_prompts(false); 49 service_->set_show_extensions_prompts(false);
43 service_->ClearProvidersForTesting(); 50 service_->ClearProvidersForTesting();
44 service_->Init(); 51 service_->Init();
45 } 52 }
46 53
47 void ShutdownExtensionProfile() { 54 void ShutdownExtensionProfile() {
48 manager_.reset(); 55 manager_.reset();
49 service_.reset(); 56 service_.reset();
50 extension_prefs_.reset(); 57 extension_prefs_.reset();
58 extension_settings_ = NULL;
51 } 59 }
52 60
53 virtual ExtensionProcessManager* GetExtensionProcessManager() { 61 virtual ExtensionProcessManager* GetExtensionProcessManager() {
54 return manager_.get(); 62 return manager_.get();
55 } 63 }
56 64
57 virtual ExtensionService* GetExtensionService() { 65 virtual ExtensionService* GetExtensionService() {
58 return service_.get(); 66 return service_.get();
59 } 67 }
60 68
61 private: 69 private:
62 scoped_ptr<ExtensionProcessManager> manager_; 70 scoped_ptr<ExtensionProcessManager> manager_;
63 scoped_ptr<ExtensionPrefs> extension_prefs_; 71 scoped_ptr<ExtensionPrefs> extension_prefs_;
72 scoped_refptr<ExtensionSettings> extension_settings_;
64 scoped_ptr<ExtensionService> service_; 73 scoped_ptr<ExtensionService> service_;
65 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_; 74 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_;
66 75
67 DISALLOW_COPY_AND_ASSIGN(ExtensionTestingProfile); 76 DISALLOW_COPY_AND_ASSIGN(ExtensionTestingProfile);
68 }; 77 };
69 78
70 class ExtensionPopupControllerTest : public CocoaTest { 79 class ExtensionPopupControllerTest : public CocoaTest {
71 public: 80 public:
72 virtual void SetUp() { 81 virtual void SetUp() {
73 CocoaTest::SetUp(); 82 CocoaTest::SetUp();
(...skipping 18 matching lines...) Expand all
92 }; 101 };
93 102
94 TEST_F(ExtensionPopupControllerTest, DISABLED_Basics) { 103 TEST_F(ExtensionPopupControllerTest, DISABLED_Basics) {
95 // TODO(andybons): Better mechanisms for mocking out the extensions service 104 // TODO(andybons): Better mechanisms for mocking out the extensions service
96 // and extensions for easy testing need to be implemented. 105 // and extensions for easy testing need to be implemented.
97 // http://crbug.com/28316 106 // http://crbug.com/28316
98 EXPECT_TRUE([ExtensionPopupController popup]); 107 EXPECT_TRUE([ExtensionPopupController popup]);
99 } 108 }
100 109
101 } // namespace 110 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698