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

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

Issue 402077: Adds popups to browser actions, completing the feature.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/scoped_nsobject.h"
6 #include "chrome/browser/cocoa/browser_test_helper.h"
7 #include "chrome/browser/cocoa/cocoa_test_helper.h"
8 #include "chrome/browser/cocoa/extensions/extension_popup_controller.h"
9 #include "chrome/browser/extensions/extension_process_manager.h"
10 #include "chrome/browser/extensions/extensions_service.h"
11 #include "chrome/test/testing_profile.h"
12
13 namespace {
14
15 class ExtensionTestingProfile : public TestingProfile {
16 public:
17 ExtensionTestingProfile() {}
18
19 FilePath GetExtensionsInstallDir() {
20 return GetPath().AppendASCII(ExtensionsService::kInstallDirectoryName);
21 }
22
23 void InitExtensionProfile() {
24 DCHECK(!GetExtensionProcessManager());
25 DCHECK(!GetExtensionsService());
26
27 manager_.reset(new ExtensionProcessManager(this));
28 service_ = new ExtensionsService(this,
29 CommandLine::ForCurrentProcess(),
30 GetPrefs(),
31 GetExtensionsInstallDir(),
32 false);
33 service_->set_extensions_enabled(true);
34 service_->set_show_extensions_prompts(false);
35 service_->ClearProvidersForTesting();
36 service_->Init();
37 }
38
39 void ShutdownExtensionProfile() {
40 manager_.reset();
41 service_ = NULL;
42 }
43
44 virtual ExtensionProcessManager* GetExtensionProcessManager() {
45 return manager_.get();
46 }
47
48 virtual ExtensionsService* GetExtensionsService() {
49 return service_.get();
50 }
51
52 private:
53 scoped_ptr<ExtensionProcessManager> manager_;
54 scoped_refptr<ExtensionsService> service_;
55
56 DISALLOW_COPY_AND_ASSIGN(ExtensionTestingProfile);
57 };
58
59 class ExtensionPopupControllerTest : public CocoaTest {
60 public:
61 virtual void SetUp() {
62 CocoaTest::SetUp();
63 profile_.reset(new ExtensionTestingProfile());
64 profile_->InitExtensionProfile();
65 browser_.reset(new Browser(Browser::TYPE_NORMAL, profile_.get()));
66 popup_controller_.reset(
67 [ExtensionPopupController showURL:GURL("http://google.com")
68 inBrowser:browser_.get()
69 anchoredAt:NSZeroPoint
70 arrowLocation:kTopRight]);
71 }
72 virtual void TearDown() {
73 profile_->ShutdownExtensionProfile();
74 CocoaTest::TearDown();
75 }
76
77 protected:
78 scoped_nsobject<ExtensionPopupController> popup_controller_;
79 scoped_ptr<Browser> browser_;
80 scoped_ptr<ExtensionTestingProfile> profile_;
81 };
82
83 TEST_F(ExtensionPopupControllerTest, DISABLED_Basics) {
84 // TODO(andybons): Better mechanisms for mocking out the extensions service
85 // and extensions for easy testing need to be implemented.
86 // http://crbug.com/28316
87 EXPECT_TRUE(popup_controller_.get());
88 }
89
90 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/extensions/extension_popup_controller.mm ('k') | chrome/browser/cocoa/info_bubble_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698