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

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

Issue 8934011: Rename IntentsHost -> WebIntentsDispatcher and IntentsDispatcher -> WebIntentsHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head Created 9 years 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/favicon/favicon_service.h" 9 #include "chrome/browser/favicon/favicon_service.h"
10 #include "chrome/browser/intents/web_intents_registry.h" 10 #include "chrome/browser/intents/web_intents_registry.h"
11 #include "chrome/browser/intents/web_intents_registry_factory.h" 11 #include "chrome/browser/intents/web_intents_registry_factory.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/intents/web_intent_picker.h" 14 #include "chrome/browser/ui/intents/web_intent_picker.h"
15 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" 15 #include "chrome/browser/ui/intents/web_intent_picker_controller.h"
16 #include "chrome/browser/ui/intents/web_intent_picker_factory.h" 16 #include "chrome/browser/ui/intents/web_intent_picker_factory.h"
17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
18 #include "chrome/browser/webdata/web_data_service.h" 18 #include "chrome/browser/webdata/web_data_service.h"
19 #include "chrome/test/base/in_process_browser_test.h" 19 #include "chrome/test/base/in_process_browser_test.h"
20 #include "chrome/test/base/ui_test_utils.h" 20 #include "chrome/test/base/ui_test_utils.h"
21 #include "content/browser/tab_contents/tab_contents.h" 21 #include "content/browser/tab_contents/tab_contents.h"
22 #include "content/public/browser/intents_host.h" 22 #include "content/public/browser/web_intents_dispatcher.h"
23 #include "testing/gmock/include/gmock/gmock.h" 23 #include "testing/gmock/include/gmock/gmock.h"
24 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
25 #include "webkit/glue/web_intent_service_data.h" 25 #include "webkit/glue/web_intent_service_data.h"
26 26
27 using testing::_; 27 using testing::_;
28 using testing::DoAll; 28 using testing::DoAll;
29 using testing::Return; 29 using testing::Return;
30 using testing::SaveArg; 30 using testing::SaveArg;
31 31
32 namespace { 32 namespace {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 92 }
93 } 93 }
94 94
95 void Close() { 95 void Close() {
96 picker_ = NULL; 96 picker_ = NULL;
97 } 97 }
98 98
99 WebIntentPicker* picker_; 99 WebIntentPicker* picker_;
100 }; 100 };
101 101
102 class IntentsHostMock : public content::IntentsHost { 102 class IntentsDispatcherMock : public content::WebIntentsDispatcher {
103 public: 103 public:
104 explicit IntentsHostMock(const webkit_glue::WebIntentData& intent) 104 explicit IntentsDispatcherMock(const webkit_glue::WebIntentData& intent)
105 : intent_(intent), 105 : intent_(intent),
106 dispatched_(false) {} 106 dispatched_(false) {}
107 107
108 virtual const webkit_glue::WebIntentData& GetIntent() { 108 virtual const webkit_glue::WebIntentData& GetIntent() {
109 return intent_; 109 return intent_;
110 } 110 }
111 111
112 virtual void DispatchIntent(TabContents* tab_contents) { 112 virtual void DispatchIntent(TabContents* tab_contents) {
113 dispatched_ = true; 113 dispatched_ = true;
114 } 114 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 SetPickerFactory(controller, picker_factory_); 172 SetPickerFactory(controller, picker_factory_);
173 173
174 controller->ShowDialog(browser(), kAction1, kType); 174 controller->ShowDialog(browser(), kAction1, kType);
175 picker_.WaitFor(2, 2); 175 picker_.WaitFor(2, 2);
176 EXPECT_EQ(2, picker_.num_urls_); 176 EXPECT_EQ(2, picker_.num_urls_);
177 EXPECT_EQ(2, picker_.num_default_icons_); 177 EXPECT_EQ(2, picker_.num_default_icons_);
178 178
179 webkit_glue::WebIntentData intent; 179 webkit_glue::WebIntentData intent;
180 intent.action = ASCIIToUTF16("a"); 180 intent.action = ASCIIToUTF16("a");
181 intent.type = ASCIIToUTF16("b"); 181 intent.type = ASCIIToUTF16("b");
182 IntentsHostMock* host = new IntentsHostMock(intent); 182 IntentsDispatcherMock* host = new IntentsDispatcherMock(intent);
183 controller->SetIntentsHost(host); 183 controller->SetIntentsDispatcher(host);
184 184
185 OnServiceChosen(controller, 1); 185 OnServiceChosen(controller, 1);
186 ASSERT_EQ(2, browser()->tab_count()); 186 ASSERT_EQ(2, browser()->tab_count());
187 EXPECT_EQ(GURL(kServiceURL2), 187 EXPECT_EQ(GURL(kServiceURL2),
188 browser()->GetSelectedTabContents()->GetURL()); 188 browser()->GetSelectedTabContents()->GetURL());
189 189
190 EXPECT_TRUE(host->dispatched_); 190 EXPECT_TRUE(host->dispatched_);
191 191
192 OnSendReturnMessage(controller); 192 OnSendReturnMessage(controller);
193 ASSERT_EQ(1, browser()->tab_count()); 193 ASSERT_EQ(1, browser()->tab_count());
194 } 194 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/intents/web_intent_picker_controller.cc ('k') | content/browser/intents/intent_injector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698