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

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

Issue 1160073004: chrome/browser/ui: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check for task runner instead of current message loop. Created 5 years, 6 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/location.h"
7 #include "base/macros.h" 8 #include "base/macros.h"
8 #include "base/message_loop/message_loop.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h"
9 #include "base/time/time.h" 11 #include "base/time/time.h"
10 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" 13 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" 14 #include "chrome/browser/ui/tabs/tab_strip_model.h"
13 #include "chrome/test/base/interactive_test_utils.h" 15 #include "chrome/test/base/interactive_test_utils.h"
14 #include "chrome/test/ppapi/ppapi_test.h" 16 #include "chrome/test/ppapi/ppapi_test.h"
15 #include "content/public/browser/render_widget_host.h" 17 #include "content/public/browser/render_widget_host.h"
16 #include "content/public/browser/render_widget_host_view.h" 18 #include "content/public/browser/render_widget_host_view.h"
17 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
18 #include "content/public/test/test_utils.h" 20 #include "content/public/test/test_utils.h"
(...skipping 10 matching lines...) Expand all
29 // Runs the current MessageLoop until |condition| is true or timeout. 31 // Runs the current MessageLoop until |condition| is true or timeout.
30 bool RunLoopUntil(const base::Callback<bool()>& condition) { 32 bool RunLoopUntil(const base::Callback<bool()>& condition) {
31 const base::TimeTicks start_time = base::TimeTicks::Now(); 33 const base::TimeTicks start_time = base::TimeTicks::Now();
32 while (!condition.Run()) { 34 while (!condition.Run()) {
33 const base::TimeTicks current_time = base::TimeTicks::Now(); 35 const base::TimeTicks current_time = base::TimeTicks::Now();
34 if (current_time - start_time > base::TimeDelta::FromSeconds(10)) { 36 if (current_time - start_time > base::TimeDelta::FromSeconds(10)) {
35 ADD_FAILURE() << "Condition not met within ten seconds."; 37 ADD_FAILURE() << "Condition not met within ten seconds.";
36 return false; 38 return false;
37 } 39 }
38 40
39 base::MessageLoop::current()->PostDelayedTask( 41 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
40 FROM_HERE, 42 FROM_HERE, base::MessageLoop::QuitClosure(),
41 base::MessageLoop::QuitClosure(),
42 base::TimeDelta::FromMilliseconds(20)); 43 base::TimeDelta::FromMilliseconds(20));
43 content::RunMessageLoop(); 44 content::RunMessageLoop();
44 } 45 }
45 return true; 46 return true;
46 } 47 }
47 48
48 } // namespace 49 } // namespace
49 50
50 // A BrowserTest that opens a test page that launches a simulated fullscreen 51 // A BrowserTest that opens a test page that launches a simulated fullscreen
51 // Flash plugin. The plugin responds to mouse clicks and key presses by 52 // Flash plugin. The plugin responds to mouse clicks and key presses by
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 ASSERT_TRUE(ObserveFlashFillColor(SK_ColorRED)); 347 ASSERT_TRUE(ObserveFlashFillColor(SK_ColorRED));
347 PressSpacebar(); 348 PressSpacebar();
348 ASSERT_TRUE(ObserveFlashFillColor(SK_ColorBLUE)); 349 ASSERT_TRUE(ObserveFlashFillColor(SK_ColorBLUE));
349 350
350 // Test that the Escape key is handled as an exit fullscreen command while the 351 // Test that the Escape key is handled as an exit fullscreen command while the
351 // Flash widget has the focus. 352 // Flash widget has the focus.
352 EXPECT_TRUE(ObserveFlashHasFocus(first_tab_contents, true)); 353 EXPECT_TRUE(ObserveFlashHasFocus(first_tab_contents, true));
353 PressEscape(); 354 PressEscape();
354 EXPECT_TRUE(ObserveTabIsInFullscreen(false)); 355 EXPECT_TRUE(ObserveTabIsInFullscreen(false));
355 } 356 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698