OLD | NEW |
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" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 WebIntentPicker*(Browser* browser, | 56 WebIntentPicker*(Browser* browser, |
57 TabContentsWrapper* wrapper, | 57 TabContentsWrapper* wrapper, |
58 WebIntentPickerDelegate* delegate)); | 58 WebIntentPickerDelegate* delegate)); |
59 MOCK_METHOD1(ClosePicker, void(WebIntentPicker* picker)); | 59 MOCK_METHOD1(ClosePicker, void(WebIntentPicker* picker)); |
60 }; | 60 }; |
61 | 61 |
62 class WebIntentPickerControllerBrowserTest : public InProcessBrowserTest { | 62 class WebIntentPickerControllerBrowserTest : public InProcessBrowserTest { |
63 protected: | 63 protected: |
64 void AddWebIntentService(const string16& action, | 64 void AddWebIntentService(const string16& action, |
65 const GURL& service_url) { | 65 const GURL& service_url) { |
66 WebIntentServiceData web_intent_service_data; | 66 webkit_glue::WebIntentServiceData service; |
67 web_intent_service_data.action = action; | 67 service.action = action; |
68 web_intent_service_data.type = kType; | 68 service.type = kType; |
69 web_intent_service_data.service_url = service_url; | 69 service.service_url = service_url; |
70 web_data_service_->AddWebIntent(web_intent_service_data); | 70 web_data_service_->AddWebIntent(service); |
71 } | 71 } |
72 | 72 |
73 void SetPickerExpectations(int expected_service_count, | 73 void SetPickerExpectations(int expected_service_count, |
74 int expected_default_favicons) { | 74 int expected_default_favicons) { |
75 EXPECT_CALL(*picker_factory_, Create(_, _, _)). | 75 EXPECT_CALL(*picker_factory_, Create(_, _, _)). |
76 WillOnce(DoAll(SaveArg<2>(&delegate_), Return(&picker_))); | 76 WillOnce(DoAll(SaveArg<2>(&delegate_), Return(&picker_))); |
77 EXPECT_CALL(picker_, | 77 EXPECT_CALL(picker_, |
78 SetServiceURLs(VectorIsOfSize(expected_service_count))). | 78 SetServiceURLs(VectorIsOfSize(expected_service_count))). |
79 Times(1); | 79 Times(1); |
80 EXPECT_CALL(picker_, SetDefaultServiceIcon(_)). | 80 EXPECT_CALL(picker_, SetDefaultServiceIcon(_)). |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 SetPickerExpectations(2, 2); | 126 SetPickerExpectations(2, 2); |
127 | 127 |
128 controller_->ShowDialog(NULL, kAction1, kType); | 128 controller_->ShowDialog(NULL, kAction1, kType); |
129 WaitForDialogToShow(); | 129 WaitForDialogToShow(); |
130 | 130 |
131 delegate_->OnServiceChosen(1); | 131 delegate_->OnServiceChosen(1); |
132 ASSERT_EQ(2, browser()->tab_count()); | 132 ASSERT_EQ(2, browser()->tab_count()); |
133 EXPECT_EQ(GURL(kServiceURL2), | 133 EXPECT_EQ(GURL(kServiceURL2), |
134 browser()->GetSelectedTabContents()->GetURL()); | 134 browser()->GetSelectedTabContents()->GetURL()); |
135 } | 135 } |
OLD | NEW |