Index: chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc |
diff --git a/chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc b/chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc |
index 491454a5acb0b9f7884f8979c606e39a870d170e..2c4c9d526bcbdb77e9b3b481125e79d62c181607 100644 |
--- a/chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc |
+++ b/chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc |
@@ -19,6 +19,7 @@ |
#include "chrome/test/base/in_process_browser_test.h" |
#include "chrome/test/base/ui_test_utils.h" |
#include "content/browser/tab_contents/tab_contents.h" |
+#include "content/public/browser/intents_host.h" |
#include "testing/gmock/include/gmock/gmock.h" |
#include "testing/gtest/include/gtest/gtest.h" |
#include "webkit/glue/web_intent_service_data.h" |
@@ -98,6 +99,31 @@ class WebIntentPickerFactoryMock : public WebIntentPickerFactory { |
WebIntentPicker* picker_; |
}; |
+class IntentsHostMock : public content::IntentsHost { |
+ public: |
+ explicit IntentsHostMock(const webkit_glue::WebIntentData& intent) |
+ : intent_(intent), |
+ dispatched_(false) {} |
+ |
+ virtual const webkit_glue::WebIntentData& GetIntent() { |
+ return intent_; |
+ } |
+ |
+ virtual void DispatchIntent(TabContents* tab_contents) { |
+ dispatched_ = true; |
+ } |
+ |
+ virtual void SendReplyMessage(webkit_glue::WebIntentReplyType reply_type, |
+ const string16& data) { |
+ } |
+ |
+ virtual void RegisterReplyNotification(const base::Closure&) { |
+ } |
+ |
+ webkit_glue::WebIntentData intent_; |
+ bool dispatched_; |
+}; |
+ |
class WebIntentPickerControllerBrowserTest : public InProcessBrowserTest { |
protected: |
void AddWebIntentService(const string16& action, |
@@ -153,13 +179,16 @@ IN_PROC_BROWSER_TEST_F(WebIntentPickerControllerBrowserTest, ChooseService) { |
webkit_glue::WebIntentData intent; |
intent.action = ASCIIToUTF16("a"); |
intent.type = ASCIIToUTF16("b"); |
- controller->SetIntent(1, intent, 1); |
+ IntentsHostMock* host = new IntentsHostMock(intent); |
+ controller->SetIntentsHost(host); |
OnServiceChosen(controller, 1); |
ASSERT_EQ(2, browser()->tab_count()); |
EXPECT_EQ(GURL(kServiceURL2), |
browser()->GetSelectedTabContents()->GetURL()); |
+ EXPECT_TRUE(host->dispatched_); |
+ |
OnSendReturnMessage(controller); |
ASSERT_EQ(1, browser()->tab_count()); |
} |