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

Side by Side Diff: chrome/browser/ui/exclusive_access/flash_fullscreen_interactive_browsertest.cc

Issue 836933005: Refactor fullscreen_controller. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync to TOT Created 5 years, 11 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 expected_in_fullscreen))) 140 expected_in_fullscreen)))
141 return false; 141 return false;
142 142
143 if (expected_in_fullscreen) { 143 if (expected_in_fullscreen) {
144 if (!GetActiveWebContents()->GetFullscreenRenderWidgetHostView()) { 144 if (!GetActiveWebContents()->GetFullscreenRenderWidgetHostView()) {
145 ADD_FAILURE() 145 ADD_FAILURE()
146 << "WebContents should have a fullscreen RenderWidgetHostView."; 146 << "WebContents should have a fullscreen RenderWidgetHostView.";
147 return false; 147 return false;
148 } 148 }
149 EXPECT_EQ(GetActiveWebContents()->GetCapturerCount() > 0, 149 EXPECT_EQ(GetActiveWebContents()->GetCapturerCount() > 0,
150 !browser()->fullscreen_controller()-> 150 !browser()
151 IsWindowFullscreenForTabOrPending()); 151 ->exclusive_access_manager()
152 ->fullscreen_controller()
153 ->IsWindowFullscreenForTabOrPending());
152 } 154 }
153 155
154 return true; 156 return true;
155 } 157 }
156 158
157 bool ObserveFlashHasFocus(content::WebContents* contents, 159 bool ObserveFlashHasFocus(content::WebContents* contents,
158 bool expected_to_have_focus) const { 160 bool expected_to_have_focus) const {
159 if (!RunLoopUntil(base::Bind( 161 if (!RunLoopUntil(base::Bind(
160 &FlashFullscreenInteractiveBrowserTest::IsObservingFlashHasFocus, 162 &FlashFullscreenInteractiveBrowserTest::IsObservingFlashHasFocus,
161 base::Unretained(this), 163 base::Unretained(this),
(...skipping 18 matching lines...) Expand all
180 bool ObserveFlashFillColor(SkColor expected_color) const { 182 bool ObserveFlashFillColor(SkColor expected_color) const {
181 return RunLoopUntil(base::Bind( 183 return RunLoopUntil(base::Bind(
182 &FlashFullscreenInteractiveBrowserTest::IsObservingFlashFillColor, 184 &FlashFullscreenInteractiveBrowserTest::IsObservingFlashFillColor,
183 base::Unretained(this), 185 base::Unretained(this),
184 expected_color)); 186 expected_color));
185 } 187 }
186 188
187 private: 189 private:
188 bool IsObservingTabInFullscreen(content::WebContents* contents, 190 bool IsObservingTabInFullscreen(content::WebContents* contents,
189 bool expected_in_fullscreen) const { 191 bool expected_in_fullscreen) const {
190 return expected_in_fullscreen == browser()->fullscreen_controller()-> 192 return expected_in_fullscreen ==
191 IsFullscreenForTabOrPending(contents); 193 browser()
194 ->exclusive_access_manager()
195 ->fullscreen_controller()
196 ->IsFullscreenForTabOrPending(contents);
192 } 197 }
193 198
194 bool IsObservingFlashHasFocus(content::WebContents* contents, 199 bool IsObservingFlashHasFocus(content::WebContents* contents,
195 bool expected_to_have_focus) const { 200 bool expected_to_have_focus) const {
196 content::RenderWidgetHostView* const flash_fs_view = 201 content::RenderWidgetHostView* const flash_fs_view =
197 contents->GetFullscreenRenderWidgetHostView(); 202 contents->GetFullscreenRenderWidgetHostView();
198 const bool flash_has_focus = flash_fs_view && flash_fs_view->HasFocus(); 203 const bool flash_has_focus = flash_fs_view && flash_fs_view->HasFocus();
199 return flash_has_focus == expected_to_have_focus; 204 return flash_has_focus == expected_to_have_focus;
200 } 205 }
201 206
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 ASSERT_TRUE(ObserveFlashFillColor(SK_ColorRED)); 346 ASSERT_TRUE(ObserveFlashFillColor(SK_ColorRED));
342 PressSpacebar(); 347 PressSpacebar();
343 ASSERT_TRUE(ObserveFlashFillColor(SK_ColorBLUE)); 348 ASSERT_TRUE(ObserveFlashFillColor(SK_ColorBLUE));
344 349
345 // Test that the Escape key is handled as an exit fullscreen command while the 350 // Test that the Escape key is handled as an exit fullscreen command while the
346 // Flash widget has the focus. 351 // Flash widget has the focus.
347 EXPECT_TRUE(ObserveFlashHasFocus(first_tab_contents, true)); 352 EXPECT_TRUE(ObserveFlashHasFocus(first_tab_contents, true));
348 PressEscape(); 353 PressEscape();
349 EXPECT_TRUE(ObserveTabIsInFullscreen(false)); 354 EXPECT_TRUE(ObserveTabIsInFullscreen(false));
350 } 355 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698