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 "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/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_tabstrip.h" | 9 #include "chrome/browser/ui/browser_tabstrip.h" |
10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
11 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 11 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
12 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh
eet.h" | 12 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh
eet.h" |
| 13 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
| 14 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h" |
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
14 #include "chrome/test/base/in_process_browser_test.h" | 16 #include "chrome/test/base/in_process_browser_test.h" |
15 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
16 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
17 #include "url/gurl.h" | 19 #include "url/gurl.h" |
18 | 20 |
19 using ::testing::NiceMock; | 21 using ::testing::NiceMock; |
20 | 22 |
21 namespace { | 23 namespace { |
22 | 24 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 ConstrainedWindowMac dialog(&delegate, tab1_, sheet_); | 149 ConstrainedWindowMac dialog(&delegate, tab1_, sheet_); |
148 EXPECT_EQ(1.0, [sheet_window_ alphaValue]); | 150 EXPECT_EQ(1.0, [sheet_window_ alphaValue]); |
149 | 151 |
150 // Close the tab. | 152 // Close the tab. |
151 TabStripModel* tab_strip = browser()->tab_strip_model(); | 153 TabStripModel* tab_strip = browser()->tab_strip_model(); |
152 EXPECT_EQ(2, tab_strip->count()); | 154 EXPECT_EQ(2, tab_strip->count()); |
153 EXPECT_TRUE(tab_strip->CloseWebContentsAt(1, | 155 EXPECT_TRUE(tab_strip->CloseWebContentsAt(1, |
154 TabStripModel::CLOSE_USER_GESTURE)); | 156 TabStripModel::CLOSE_USER_GESTURE)); |
155 EXPECT_EQ(1, tab_strip->count()); | 157 EXPECT_EQ(1, tab_strip->count()); |
156 } | 158 } |
| 159 |
| 160 // Test that the sheet is still visible after entering and exiting fullscreen. |
| 161 IN_PROC_BROWSER_TEST_F(ConstrainedWindowMacTest, BrowserWindowFullscreen) { |
| 162 NiceMock<ConstrainedWindowDelegateMock> delegate; |
| 163 ConstrainedWindowMac dialog(&delegate, tab1_, sheet_); |
| 164 EXPECT_EQ(1.0, [sheet_window_ alphaValue]); |
| 165 |
| 166 // Toggle fullscreen twice: one for entering and one for exiting. |
| 167 // Check to see if the sheet is visible. |
| 168 for (int i = 0; i < 2; i++) { |
| 169 { |
| 170 // NOTIFICATION_FULLSCREEN_CHANGED is sent asynchronously. Wait for the |
| 171 // notification before testing the sheet's visibility. |
| 172 scoped_ptr<FullscreenNotificationObserver> waiter( |
| 173 new FullscreenNotificationObserver()); |
| 174 browser() |
| 175 ->exclusive_access_manager() |
| 176 ->fullscreen_controller() |
| 177 ->ToggleBrowserFullscreenMode(); |
| 178 waiter->Wait(); |
| 179 } |
| 180 EXPECT_EQ(1.0, [sheet_window_ alphaValue]); |
| 181 } |
| 182 |
| 183 dialog.CloseWebContentsModalDialog(); |
| 184 } |
OLD | NEW |