| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/views/frame/browser_non_client_frame_view_ash.h" | 5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h" |
| 6 | 6 |
| 7 #include "ash/ash_constants.h" | 7 #include "ash/ash_constants.h" |
| 8 #include "ash/ash_switches.h" | 8 #include "ash/ash_switches.h" |
| 9 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" | 9 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" |
| 10 #include "ash/frame/header_painter.h" | 10 #include "ash/frame/header_painter.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 static_cast<BrowserNonClientFrameViewAsh*>( | 73 static_cast<BrowserNonClientFrameViewAsh*>( |
| 74 widget->non_client_view()->frame_view()); | 74 widget->non_client_view()->frame_view()); |
| 75 | 75 |
| 76 // Frame paints by default. | 76 // Frame paints by default. |
| 77 EXPECT_TRUE(frame_view->ShouldPaint()); | 77 EXPECT_TRUE(frame_view->ShouldPaint()); |
| 78 | 78 |
| 79 // No painting should occur in non-immersive fullscreen. (We enter into tab | 79 // No painting should occur in non-immersive fullscreen. (We enter into tab |
| 80 // fullscreen here because tab fullscreen is non-immersive even on ChromeOS). | 80 // fullscreen here because tab fullscreen is non-immersive even on ChromeOS). |
| 81 { | 81 { |
| 82 // NOTIFICATION_FULLSCREEN_CHANGED is sent asynchronously. | 82 // NOTIFICATION_FULLSCREEN_CHANGED is sent asynchronously. |
| 83 scoped_ptr<FullscreenNotificationObserver> waiter( | 83 std::unique_ptr<FullscreenNotificationObserver> waiter( |
| 84 new FullscreenNotificationObserver()); | 84 new FullscreenNotificationObserver()); |
| 85 browser() | 85 browser() |
| 86 ->exclusive_access_manager() | 86 ->exclusive_access_manager() |
| 87 ->fullscreen_controller() | 87 ->fullscreen_controller() |
| 88 ->EnterFullscreenModeForTab(web_contents, GURL()); | 88 ->EnterFullscreenModeForTab(web_contents, GURL()); |
| 89 waiter->Wait(); | 89 waiter->Wait(); |
| 90 } | 90 } |
| 91 EXPECT_FALSE(browser_view->immersive_mode_controller()->IsEnabled()); | 91 EXPECT_FALSE(browser_view->immersive_mode_controller()->IsEnabled()); |
| 92 EXPECT_FALSE(frame_view->ShouldPaint()); | 92 EXPECT_FALSE(frame_view->ShouldPaint()); |
| 93 | 93 |
| 94 // The client view abuts top of the window. | 94 // The client view abuts top of the window. |
| 95 EXPECT_EQ(0, frame_view->GetBoundsForClientView().y()); | 95 EXPECT_EQ(0, frame_view->GetBoundsForClientView().y()); |
| 96 | 96 |
| 97 // The frame should be painted again when fullscreen is exited and the caption | 97 // The frame should be painted again when fullscreen is exited and the caption |
| 98 // buttons should be visible. | 98 // buttons should be visible. |
| 99 { | 99 { |
| 100 scoped_ptr<FullscreenNotificationObserver> waiter( | 100 std::unique_ptr<FullscreenNotificationObserver> waiter( |
| 101 new FullscreenNotificationObserver()); | 101 new FullscreenNotificationObserver()); |
| 102 chrome::ToggleFullscreenMode(browser()); | 102 chrome::ToggleFullscreenMode(browser()); |
| 103 waiter->Wait(); | 103 waiter->Wait(); |
| 104 } | 104 } |
| 105 EXPECT_TRUE(frame_view->ShouldPaint()); | 105 EXPECT_TRUE(frame_view->ShouldPaint()); |
| 106 EXPECT_TRUE(frame_view->caption_button_container_->visible()); | 106 EXPECT_TRUE(frame_view->caption_button_container_->visible()); |
| 107 } | 107 } |
| 108 | 108 |
| 109 // TODO(zturner): Change this to USE_ASH after fixing the test on Windows. | 109 // TODO(zturner): Change this to USE_ASH after fixing the test on Windows. |
| 110 #if defined(OS_CHROMEOS) | 110 #if defined(OS_CHROMEOS) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 127 | 127 |
| 128 // Frame paints by default. | 128 // Frame paints by default. |
| 129 EXPECT_TRUE(frame_view->ShouldPaint()); | 129 EXPECT_TRUE(frame_view->ShouldPaint()); |
| 130 EXPECT_LT(Tab::GetImmersiveHeight(), | 130 EXPECT_LT(Tab::GetImmersiveHeight(), |
| 131 frame_view->header_painter_->GetHeaderHeightForPainting()); | 131 frame_view->header_painter_->GetHeaderHeightForPainting()); |
| 132 | 132 |
| 133 // Enter both browser fullscreen and tab fullscreen. Entering browser | 133 // Enter both browser fullscreen and tab fullscreen. Entering browser |
| 134 // fullscreen should enable immersive fullscreen. | 134 // fullscreen should enable immersive fullscreen. |
| 135 { | 135 { |
| 136 // NOTIFICATION_FULLSCREEN_CHANGED is sent asynchronously. | 136 // NOTIFICATION_FULLSCREEN_CHANGED is sent asynchronously. |
| 137 scoped_ptr<FullscreenNotificationObserver> waiter( | 137 std::unique_ptr<FullscreenNotificationObserver> waiter( |
| 138 new FullscreenNotificationObserver()); | 138 new FullscreenNotificationObserver()); |
| 139 chrome::ToggleFullscreenMode(browser()); | 139 chrome::ToggleFullscreenMode(browser()); |
| 140 waiter->Wait(); | 140 waiter->Wait(); |
| 141 } | 141 } |
| 142 { | 142 { |
| 143 scoped_ptr<FullscreenNotificationObserver> waiter( | 143 std::unique_ptr<FullscreenNotificationObserver> waiter( |
| 144 new FullscreenNotificationObserver()); | 144 new FullscreenNotificationObserver()); |
| 145 browser() | 145 browser() |
| 146 ->exclusive_access_manager() | 146 ->exclusive_access_manager() |
| 147 ->fullscreen_controller() | 147 ->fullscreen_controller() |
| 148 ->EnterFullscreenModeForTab(web_contents, GURL()); | 148 ->EnterFullscreenModeForTab(web_contents, GURL()); |
| 149 waiter->Wait(); | 149 waiter->Wait(); |
| 150 } | 150 } |
| 151 EXPECT_TRUE(immersive_mode_controller->IsEnabled()); | 151 EXPECT_TRUE(immersive_mode_controller->IsEnabled()); |
| 152 | 152 |
| 153 // An immersive reveal shows the buttons and the top of the frame. | 153 // An immersive reveal shows the buttons and the top of the frame. |
| 154 scoped_ptr<ImmersiveRevealedLock> revealed_lock( | 154 std::unique_ptr<ImmersiveRevealedLock> revealed_lock( |
| 155 immersive_mode_controller->GetRevealedLock( | 155 immersive_mode_controller->GetRevealedLock( |
| 156 ImmersiveModeController::ANIMATE_REVEAL_NO)); | 156 ImmersiveModeController::ANIMATE_REVEAL_NO)); |
| 157 EXPECT_TRUE(immersive_mode_controller->IsRevealed()); | 157 EXPECT_TRUE(immersive_mode_controller->IsRevealed()); |
| 158 EXPECT_TRUE(frame_view->ShouldPaint()); | 158 EXPECT_TRUE(frame_view->ShouldPaint()); |
| 159 EXPECT_TRUE(frame_view->caption_button_container_->visible()); | 159 EXPECT_TRUE(frame_view->caption_button_container_->visible()); |
| 160 EXPECT_FALSE(frame_view->UseImmersiveLightbarHeaderStyle()); | 160 EXPECT_FALSE(frame_view->UseImmersiveLightbarHeaderStyle()); |
| 161 | 161 |
| 162 // End the reveal. When in both immersive browser fullscreen and tab | 162 // End the reveal. When in both immersive browser fullscreen and tab |
| 163 // fullscreen, the tab lightbars should not be painted. | 163 // fullscreen, the tab lightbars should not be painted. |
| 164 revealed_lock.reset(); | 164 revealed_lock.reset(); |
| 165 EXPECT_FALSE(immersive_mode_controller->IsRevealed()); | 165 EXPECT_FALSE(immersive_mode_controller->IsRevealed()); |
| 166 EXPECT_FALSE(frame_view->ShouldPaint()); | 166 EXPECT_FALSE(frame_view->ShouldPaint()); |
| 167 EXPECT_EQ(0, frame_view->header_painter_->GetHeaderHeightForPainting()); | 167 EXPECT_EQ(0, frame_view->header_painter_->GetHeaderHeightForPainting()); |
| 168 | 168 |
| 169 // Repeat test but without tab fullscreen. The tab lightbars should now show | 169 // Repeat test but without tab fullscreen. The tab lightbars should now show |
| 170 // when the top-of-window views are not revealed. | 170 // when the top-of-window views are not revealed. |
| 171 { | 171 { |
| 172 scoped_ptr<FullscreenNotificationObserver> waiter( | 172 std::unique_ptr<FullscreenNotificationObserver> waiter( |
| 173 new FullscreenNotificationObserver()); | 173 new FullscreenNotificationObserver()); |
| 174 browser() | 174 browser() |
| 175 ->exclusive_access_manager() | 175 ->exclusive_access_manager() |
| 176 ->fullscreen_controller() | 176 ->fullscreen_controller() |
| 177 ->ExitFullscreenModeForTab(web_contents); | 177 ->ExitFullscreenModeForTab(web_contents); |
| 178 waiter->Wait(); | 178 waiter->Wait(); |
| 179 } | 179 } |
| 180 | 180 |
| 181 // Immersive reveal should have same behavior as before. | 181 // Immersive reveal should have same behavior as before. |
| 182 revealed_lock.reset(immersive_mode_controller->GetRevealedLock( | 182 revealed_lock.reset(immersive_mode_controller->GetRevealedLock( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 193 revealed_lock.reset(); | 193 revealed_lock.reset(); |
| 194 EXPECT_TRUE(frame_view->ShouldPaint()); | 194 EXPECT_TRUE(frame_view->ShouldPaint()); |
| 195 EXPECT_FALSE(frame_view->caption_button_container_->visible()); | 195 EXPECT_FALSE(frame_view->caption_button_container_->visible()); |
| 196 EXPECT_TRUE(frame_view->UseImmersiveLightbarHeaderStyle()); | 196 EXPECT_TRUE(frame_view->UseImmersiveLightbarHeaderStyle()); |
| 197 EXPECT_EQ(Tab::GetImmersiveHeight(), | 197 EXPECT_EQ(Tab::GetImmersiveHeight(), |
| 198 frame_view->header_painter_->GetHeaderHeightForPainting()); | 198 frame_view->header_painter_->GetHeaderHeightForPainting()); |
| 199 | 199 |
| 200 // Exiting immersive fullscreen should make the caption buttons and the frame | 200 // Exiting immersive fullscreen should make the caption buttons and the frame |
| 201 // visible again. | 201 // visible again. |
| 202 { | 202 { |
| 203 scoped_ptr<FullscreenNotificationObserver> waiter( | 203 std::unique_ptr<FullscreenNotificationObserver> waiter( |
| 204 new FullscreenNotificationObserver()); | 204 new FullscreenNotificationObserver()); |
| 205 browser_view->ExitFullscreen(); | 205 browser_view->ExitFullscreen(); |
| 206 waiter->Wait(); | 206 waiter->Wait(); |
| 207 } | 207 } |
| 208 EXPECT_FALSE(immersive_mode_controller->IsEnabled()); | 208 EXPECT_FALSE(immersive_mode_controller->IsEnabled()); |
| 209 EXPECT_TRUE(frame_view->ShouldPaint()); | 209 EXPECT_TRUE(frame_view->ShouldPaint()); |
| 210 EXPECT_TRUE(frame_view->caption_button_container_->visible()); | 210 EXPECT_TRUE(frame_view->caption_button_container_->visible()); |
| 211 EXPECT_FALSE(frame_view->UseImmersiveLightbarHeaderStyle()); | 211 EXPECT_FALSE(frame_view->UseImmersiveLightbarHeaderStyle()); |
| 212 EXPECT_LT(Tab::GetImmersiveHeight(), | 212 EXPECT_LT(Tab::GetImmersiveHeight(), |
| 213 frame_view->header_painter_->GetHeaderHeightForPainting()); | 213 frame_view->header_painter_->GetHeaderHeightForPainting()); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 const gfx::Rect during_maximize = frame_view->caption_button_container_-> | 291 const gfx::Rect during_maximize = frame_view->caption_button_container_-> |
| 292 bounds(); | 292 bounds(); |
| 293 EXPECT_GT(initial.width(), during_maximize.width()); | 293 EXPECT_GT(initial.width(), during_maximize.width()); |
| 294 ash::Shell::GetInstance()->maximize_mode_controller()-> | 294 ash::Shell::GetInstance()->maximize_mode_controller()-> |
| 295 EnableMaximizeModeWindowManager(false); | 295 EnableMaximizeModeWindowManager(false); |
| 296 test.EndAnimations(); | 296 test.EndAnimations(); |
| 297 const gfx::Rect after_restore = frame_view->caption_button_container_-> | 297 const gfx::Rect after_restore = frame_view->caption_button_container_-> |
| 298 bounds(); | 298 bounds(); |
| 299 EXPECT_EQ(initial, after_restore); | 299 EXPECT_EQ(initial, after_restore); |
| 300 } | 300 } |
| OLD | NEW |