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

Side by Side Diff: chrome/browser/ui/cocoa/web_intent_sheet_controller_browsertest.mm

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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) 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/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "chrome/test/base/in_process_browser_test.h" 6 #include "chrome/test/base/in_process_browser_test.h"
7 #include "chrome/browser/ui/browser.h" 7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/browser_tabstrip.h"
8 #include "chrome/browser/ui/cocoa/web_intent_picker_cocoa.h" 9 #include "chrome/browser/ui/cocoa/web_intent_picker_cocoa.h"
9 #import "chrome/browser/ui/cocoa/web_intent_sheet_controller.h" 10 #import "chrome/browser/ui/cocoa/web_intent_sheet_controller.h"
10 #include "chrome/browser/ui/intents/web_intent_picker_delegate.h" 11 #include "chrome/browser/ui/intents/web_intent_picker_delegate.h"
11 #include "chrome/browser/ui/intents/web_intent_picker_model.h" 12 #include "chrome/browser/ui/intents/web_intent_picker_model.h"
12 #include "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
13 14
14 class MockIntentPickerDelegate : public WebIntentPickerDelegate { 15 class MockIntentPickerDelegate : public WebIntentPickerDelegate {
15 public: 16 public:
16 MockIntentPickerDelegate() {} 17 MockIntentPickerDelegate() {}
17 virtual ~MockIntentPickerDelegate() {} 18 virtual ~MockIntentPickerDelegate() {}
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 52
52 void WebIntentSheetControllerBrowserTest::CreatePicker() { 53 void WebIntentSheetControllerBrowserTest::CreatePicker() {
53 picker_.reset(new WebIntentPickerCocoa()); 54 picker_.reset(new WebIntentPickerCocoa());
54 picker_->delegate_ = &delegate_; 55 picker_->delegate_ = &delegate_;
55 picker_->model_ = &model_; 56 picker_->model_ = &model_;
56 window_ = nil; 57 window_ = nil;
57 controller_ = nil; 58 controller_ = nil;
58 } 59 }
59 60
60 IN_PROC_BROWSER_TEST_F(WebIntentSheetControllerBrowserTest, CloseWillClose) { 61 IN_PROC_BROWSER_TEST_F(WebIntentSheetControllerBrowserTest, CloseWillClose) {
61 CreateBubble(browser()->GetActiveTabContents()); 62 CreateBubble(chrome::GetActiveTabContents(browser()));
62 63
63 EXPECT_CALL(delegate_, OnPickerClosed()).Times(0); 64 EXPECT_CALL(delegate_, OnPickerClosed()).Times(0);
64 EXPECT_CALL(delegate_, OnClosing()); 65 EXPECT_CALL(delegate_, OnClosing());
65 picker_->Close(); 66 picker_->Close();
66 67
67 ignore_result(picker_.release()); // Closing |picker_| will destruct it. 68 ignore_result(picker_.release()); // Closing |picker_| will destruct it.
68 } 69 }
69 70
70 IN_PROC_BROWSER_TEST_F(WebIntentSheetControllerBrowserTest, 71 IN_PROC_BROWSER_TEST_F(WebIntentSheetControllerBrowserTest,
71 DontCancelAfterServiceInvokation) { 72 DontCancelAfterServiceInvokation) {
72 CreateBubble(browser()->GetActiveTabContents()); 73 CreateBubble(chrome::GetActiveTabContents(browser()));
73 74
74 GURL url; 75 GURL url;
75 model_.AddInstalledService(string16(), url, 76 model_.AddInstalledService(string16(), url,
76 WebIntentPickerModel::DISPOSITION_WINDOW); 77 WebIntentPickerModel::DISPOSITION_WINDOW);
77 78
78 EXPECT_CALL(delegate_, OnServiceChosen( 79 EXPECT_CALL(delegate_, OnServiceChosen(
79 url, WebIntentPickerModel::DISPOSITION_WINDOW)); 80 url, WebIntentPickerModel::DISPOSITION_WINDOW));
80 EXPECT_CALL(delegate_, OnPickerClosed()).Times(0); 81 EXPECT_CALL(delegate_, OnPickerClosed()).Times(0);
81 EXPECT_CALL(delegate_, OnClosing()); 82 EXPECT_CALL(delegate_, OnClosing());
82 83
83 picker_->OnServiceChosen(0); 84 picker_->OnServiceChosen(0);
84 picker_->Close(); 85 picker_->Close();
85 86
86 ignore_result(picker_.release()); // Closing |picker_| will destruct it. 87 ignore_result(picker_.release()); // Closing |picker_| will destruct it.
87 } 88 }
88 89
89 IN_PROC_BROWSER_TEST_F(WebIntentSheetControllerBrowserTest, 90 IN_PROC_BROWSER_TEST_F(WebIntentSheetControllerBrowserTest,
90 OnCancelledWillSignalClose) { 91 OnCancelledWillSignalClose) {
91 CreatePicker(); 92 CreatePicker();
92 EXPECT_CALL(delegate_, OnPickerClosed()); 93 EXPECT_CALL(delegate_, OnPickerClosed());
93 EXPECT_CALL(delegate_, OnClosing()); 94 EXPECT_CALL(delegate_, OnClosing());
94 picker_->OnCancelled(); 95 picker_->OnCancelled();
95 96
96 ignore_result(picker_.release()); // Closing |picker_| will destruct it. 97 ignore_result(picker_.release()); // Closing |picker_| will destruct it.
97 } 98 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm ('k') | chrome/browser/ui/extensions/application_launch.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698