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

Side by Side Diff: chrome/browser/ui/intents/web_intent_picker_controller_unittest.cc

Issue 7782015: content: Move web intent constrained window to TabContentsWrapper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 MOCK_METHOD1(SetServiceURLs, void(const std::vector<GURL>& urls)); 80 MOCK_METHOD1(SetServiceURLs, void(const std::vector<GURL>& urls));
81 MOCK_METHOD2(SetServiceIcon, void(size_t index, const SkBitmap& icon)); 81 MOCK_METHOD2(SetServiceIcon, void(size_t index, const SkBitmap& icon));
82 MOCK_METHOD1(SetDefaultServiceIcon, void(size_t index)); 82 MOCK_METHOD1(SetDefaultServiceIcon, void(size_t index));
83 MOCK_METHOD0(Show, void(void)); 83 MOCK_METHOD0(Show, void(void));
84 MOCK_METHOD0(Close, void(void)); 84 MOCK_METHOD0(Close, void(void));
85 }; 85 };
86 86
87 class WebIntentPickerFactoryMock : public WebIntentPickerFactory { 87 class WebIntentPickerFactoryMock : public WebIntentPickerFactory {
88 public: 88 public:
89 MOCK_METHOD2(Create, 89 MOCK_METHOD2(Create,
90 WebIntentPicker*(TabContents* tab_contents, 90 WebIntentPicker*(TabContentsWrapper* wrapper,
91 WebIntentPickerDelegate* delegate)); 91 WebIntentPickerDelegate* delegate));
92 MOCK_METHOD1(ClosePicker, void(WebIntentPicker* picker)); 92 MOCK_METHOD1(ClosePicker, void(WebIntentPicker* picker));
93 }; 93 };
94 94
95 class TestWebIntentPickerController : public WebIntentPickerController { 95 class TestWebIntentPickerController : public WebIntentPickerController {
96 public: 96 public:
97 TestWebIntentPickerController(TabContents* tab_contents, 97 TestWebIntentPickerController(TabContentsWrapper* wrapper,
98 WebIntentPickerFactory* factory) 98 WebIntentPickerFactory* factory)
99 : WebIntentPickerController(tab_contents, factory) { 99 : WebIntentPickerController(wrapper, factory) {
100 } 100 }
101 101
102 MOCK_METHOD1(OnServiceChosen, void(size_t index)); 102 MOCK_METHOD1(OnServiceChosen, void(size_t index));
103 MOCK_METHOD0(OnCancelled, void(void)); 103 MOCK_METHOD0(OnCancelled, void(void));
104 104
105 // helper functions to forward to the base class. 105 // helper functions to forward to the base class.
106 void BaseOnServiceChosen(size_t index) { 106 void BaseOnServiceChosen(size_t index) {
107 WebIntentPickerController::OnServiceChosen(index); 107 WebIntentPickerController::OnServiceChosen(index);
108 } 108 }
109 109
(...skipping 16 matching lines...) Expand all
126 126
127 profile_->CreateFaviconService(); 127 profile_->CreateFaviconService();
128 profile_->CreateWebDataService(true); 128 profile_->CreateWebDataService(true);
129 web_data_service_ = profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); 129 web_data_service_ = profile_->GetWebDataService(Profile::EXPLICIT_ACCESS);
130 favicon_service_ = profile_->GetFaviconService(Profile::EXPLICIT_ACCESS); 130 favicon_service_ = profile_->GetFaviconService(Profile::EXPLICIT_ACCESS);
131 WebIntentsRegistry *registry = 131 WebIntentsRegistry *registry =
132 WebIntentsRegistryFactory::GetForProfile(profile_.get()); 132 WebIntentsRegistryFactory::GetForProfile(profile_.get());
133 registry->Initialize(web_data_service_); 133 registry->Initialize(web_data_service_);
134 134
135 picker_factory_ = new WebIntentPickerFactoryMock(); 135 picker_factory_ = new WebIntentPickerFactoryMock();
136 controller_.reset(new TestWebIntentPickerController(contents(), 136 controller_.reset(new TestWebIntentPickerController(contents_wrapper(),
137 picker_factory_)); 137 picker_factory_));
138 } 138 }
139 139
140 virtual void TearDown() { 140 virtual void TearDown() {
141 controller_.reset(); 141 controller_.reset();
142 142
143 TabContentsWrapperTestHarness::TearDown(); 143 TabContentsWrapperTestHarness::TearDown();
144 } 144 }
145 145
146 protected: 146 protected:
147 void AddWebIntentService(const string16& action, 147 void AddWebIntentService(const string16& action,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 .Times(0); 264 .Times(0);
265 EXPECT_CALL(*controller_, OnCancelled()) 265 EXPECT_CALL(*controller_, OnCancelled())
266 .WillOnce(Invoke(controller_.get(), 266 .WillOnce(Invoke(controller_.get(),
267 &TestWebIntentPickerController::BaseOnCancelled)); 267 &TestWebIntentPickerController::BaseOnCancelled));
268 EXPECT_CALL(*picker_factory_, ClosePicker(_)); 268 EXPECT_CALL(*picker_factory_, ClosePicker(_));
269 269
270 controller_->ShowDialog(kAction1, kType); 270 controller_->ShowDialog(kAction1, kType);
271 WaitForDialogToShow(); 271 WaitForDialogToShow();
272 delegate_->OnCancelled(); 272 delegate_->OnCancelled();
273 } 273 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/intents/web_intent_picker_controller.cc ('k') | chrome/browser/ui/intents/web_intent_picker_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698