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

Side by Side Diff: chrome/browser/ui/cocoa/constrained_window/constrained_window_mac_browsertest.mm

Issue 12334073: Remove WebContents methods that duplicate WebContentsView methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" 5 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h"
6 6
7 #include "chrome/app/chrome_command_ids.h" 7 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_commands.h" 10 #include "chrome/browser/ui/browser_commands.h"
11 #include "chrome/browser/ui/browser_tabstrip.h" 11 #include "chrome/browser/ui/browser_tabstrip.h"
12 #include "chrome/browser/ui/browser_window.h" 12 #include "chrome/browser/ui/browser_window.h"
13 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 13 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
14 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h" 14 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h"
15 #include "chrome/browser/ui/tabs/tab_strip_model.h" 15 #include "chrome/browser/ui/tabs/tab_strip_model.h"
16 #include "chrome/test/base/in_process_browser_test.h" 16 #include "chrome/test/base/in_process_browser_test.h"
17 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
18 #include "content/public/browser/web_contents_view.h"
18 #include "googleurl/src/gurl.h" 19 #include "googleurl/src/gurl.h"
19 #include "testing/gmock/include/gmock/gmock.h" 20 #include "testing/gmock/include/gmock/gmock.h"
20 21
21 using ::testing::NiceMock; 22 using ::testing::NiceMock;
22 23
23 namespace { 24 namespace {
24 25
25 class ConstrainedWindowDelegateMock : public ConstrainedWindowMacDelegate { 26 class ConstrainedWindowDelegateMock : public ConstrainedWindowMacDelegate {
26 public: 27 public:
27 MOCK_METHOD1(OnConstrainedWindowClosed, void(ConstrainedWindowMac*)); 28 MOCK_METHOD1(OnConstrainedWindowClosed, void(ConstrainedWindowMac*));
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // a tab works correctly. 94 // a tab works correctly.
94 IN_PROC_BROWSER_TEST_F(ConstrainedWindowMacTest, ShowInUninitializedTab) { 95 IN_PROC_BROWSER_TEST_F(ConstrainedWindowMacTest, ShowInUninitializedTab) {
95 scoped_ptr<content::WebContents> web_contents(content::WebContents::Create( 96 scoped_ptr<content::WebContents> web_contents(content::WebContents::Create(
96 content::WebContents::CreateParams(browser()->profile()))); 97 content::WebContents::CreateParams(browser()->profile())));
97 bool was_blocked = false; 98 bool was_blocked = false;
98 chrome::AddWebContents(browser(), NULL, web_contents.release(), 99 chrome::AddWebContents(browser(), NULL, web_contents.release(),
99 NEW_BACKGROUND_TAB, gfx::Rect(), false, &was_blocked); 100 NEW_BACKGROUND_TAB, gfx::Rect(), false, &was_blocked);
100 content::WebContents* tab2 = 101 content::WebContents* tab2 =
101 browser()->tab_strip_model()->GetWebContentsAt(2); 102 browser()->tab_strip_model()->GetWebContentsAt(2);
102 ASSERT_TRUE(tab2); 103 ASSERT_TRUE(tab2);
103 EXPECT_FALSE([tab2->GetNativeView() superview]); 104 EXPECT_FALSE([tab2->GetView()->GetNativeView() superview]);
104 105
105 // Show dialog and verify that it's not visible yet. 106 // Show dialog and verify that it's not visible yet.
106 NiceMock<ConstrainedWindowDelegateMock> delegate; 107 NiceMock<ConstrainedWindowDelegateMock> delegate;
107 ConstrainedWindowMac dialog(&delegate, tab2, sheet_); 108 ConstrainedWindowMac dialog(&delegate, tab2, sheet_);
108 EXPECT_FALSE([sheet_window_ isVisible]); 109 EXPECT_FALSE([sheet_window_ isVisible]);
109 110
110 // Activate the tab and verify that the constrained window is shown. 111 // Activate the tab and verify that the constrained window is shown.
111 browser()->tab_strip_model()->ActivateTabAt(2, true); 112 browser()->tab_strip_model()->ActivateTabAt(2, true);
112 EXPECT_TRUE([tab2->GetNativeView() superview]); 113 EXPECT_TRUE([tab2->GetView()->GetNativeView() superview]);
113 EXPECT_TRUE([sheet_window_ isVisible]); 114 EXPECT_TRUE([sheet_window_ isVisible]);
114 EXPECT_EQ(1.0, [sheet_window_ alphaValue]); 115 EXPECT_EQ(1.0, [sheet_window_ alphaValue]);
115 116
116 dialog.CloseWebContentsModalDialog(); 117 dialog.CloseWebContentsModalDialog();
117 } 118 }
118 119
119 // Test that adding a sheet disables tab dragging. 120 // Test that adding a sheet disables tab dragging.
120 IN_PROC_BROWSER_TEST_F(ConstrainedWindowMacTest, TabDragging) { 121 IN_PROC_BROWSER_TEST_F(ConstrainedWindowMacTest, TabDragging) {
121 NiceMock<ConstrainedWindowDelegateMock> delegate; 122 NiceMock<ConstrainedWindowDelegateMock> delegate;
122 ConstrainedWindowMac dialog(&delegate, tab1_, sheet_); 123 ConstrainedWindowMac dialog(&delegate, tab1_, sheet_);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN)); 162 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN));
162 163
163 // Dialog will delete it self when closed. 164 // Dialog will delete it self when closed.
164 NiceMock<ConstrainedWindowDelegateMock> delegate; 165 NiceMock<ConstrainedWindowDelegateMock> delegate;
165 ConstrainedWindowMac dialog(&delegate, tab1_, sheet_); 166 ConstrainedWindowMac dialog(&delegate, tab1_, sheet_);
166 167
167 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN)); 168 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN));
168 169
169 dialog.CloseWebContentsModalDialog(); 170 dialog.CloseWebContentsModalDialog();
170 } 171 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/constrained_web_dialog_delegate_mac.mm ('k') | chrome/browser/ui/cocoa/dev_tools_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698