OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 7 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
8 #import "chrome/browser/ui/cocoa/hover_close_button.h" | 8 #import "chrome/browser/ui/cocoa/hover_close_button.h" |
9 #import "chrome/browser/ui/cocoa/hyperlink_button_cell.h" | 9 #import "chrome/browser/ui/cocoa/hyperlink_button_cell.h" |
10 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 10 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
11 #import "chrome/browser/ui/cocoa/web_intent_sheet_controller.h" | 11 #import "chrome/browser/ui/cocoa/web_intent_sheet_controller.h" |
12 #include "chrome/browser/ui/cocoa/web_intent_picker_cocoa.h" | 12 #include "chrome/browser/ui/cocoa/web_intent_picker_cocoa.h" |
13 #include "chrome/browser/ui/intents/web_intent_picker_delegate.h" | 13 #include "chrome/browser/ui/intents/web_intent_picker_delegate.h" |
14 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" | 14 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" |
15 #include "content/browser/tab_contents/test_tab_contents.h" | 15 #include "content/browser/tab_contents/test_tab_contents.h" |
16 #include "content/test/test_browser_thread.h" | 16 #include "content/test/test_browser_thread.h" |
17 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 class MockIntentPickerDelegate : public WebIntentPickerDelegate { | 21 class MockIntentPickerDelegate : public WebIntentPickerDelegate { |
22 public: | 22 public: |
23 virtual ~MockIntentPickerDelegate() {} | 23 virtual ~MockIntentPickerDelegate() {} |
24 | 24 |
25 MOCK_METHOD2(OnServiceChosen, void(const GURL& url, Disposition disposition)); | 25 MOCK_METHOD2(OnServiceChosen, void(const GURL& url, Disposition disposition)); |
26 MOCK_METHOD1(OnInlineDispositionWebContentsCreated, | 26 MOCK_METHOD1(OnInlineDispositionWebContentsCreated, |
27 void(content::WebContents* web_contents)); | 27 void(content::WebContents* web_contents)); |
| 28 MOCK_METHOD1(OnExtensionInstallRequested, void(const std::string& id)); |
28 MOCK_METHOD0(OnCancelled, void()); | 29 MOCK_METHOD0(OnCancelled, void()); |
29 MOCK_METHOD0(OnClosing, void()); | 30 MOCK_METHOD0(OnClosing, void()); |
30 }; | 31 }; |
31 | 32 |
32 } // namespace | 33 } // namespace |
33 | 34 |
34 class WebIntentPickerSheetControllerTest | 35 class WebIntentPickerSheetControllerTest |
35 : public TabContentsWrapperTestHarness { | 36 : public TabContentsWrapperTestHarness { |
36 public: | 37 public: |
37 WebIntentPickerSheetControllerTest() | 38 WebIntentPickerSheetControllerTest() |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 EXPECT_CALL(delegate_, OnServiceChosen( | 186 EXPECT_CALL(delegate_, OnServiceChosen( |
186 url, WebIntentPickerModel::DISPOSITION_WINDOW)); | 187 url, WebIntentPickerModel::DISPOSITION_WINDOW)); |
187 EXPECT_CALL(delegate_, OnCancelled()).Times(0); | 188 EXPECT_CALL(delegate_, OnCancelled()).Times(0); |
188 EXPECT_CALL(delegate_, OnClosing()); | 189 EXPECT_CALL(delegate_, OnClosing()); |
189 | 190 |
190 picker_->OnServiceChosen(0); | 191 picker_->OnServiceChosen(0); |
191 picker_->Close(); | 192 picker_->Close(); |
192 | 193 |
193 ignore_result(picker_.release()); // Closing |picker_| will destruct it. | 194 ignore_result(picker_.release()); // Closing |picker_| will destruct it. |
194 } | 195 } |
OLD | NEW |