Index: chrome/browser/ui/exclusive_access/flash_fullscreen_interactive_browsertest.cc |
diff --git a/chrome/browser/ui/exclusive_access/flash_fullscreen_interactive_browsertest.cc b/chrome/browser/ui/exclusive_access/flash_fullscreen_interactive_browsertest.cc |
index 7c987e18aea79767c530fd2f10a64525147bbb73..b1558d0f6e51ab646f36485e4787bf2828da7fbf 100644 |
--- a/chrome/browser/ui/exclusive_access/flash_fullscreen_interactive_browsertest.cc |
+++ b/chrome/browser/ui/exclusive_access/flash_fullscreen_interactive_browsertest.cc |
@@ -26,24 +26,6 @@ const bool kIsMacUI = true; |
const bool kIsMacUI = false; |
#endif |
-// Runs the current MessageLoop until |condition| is true or timeout. |
-bool RunLoopUntil(const base::Callback<bool()>& condition) { |
- const base::TimeTicks start_time = base::TimeTicks::Now(); |
- while (!condition.Run()) { |
- const base::TimeTicks current_time = base::TimeTicks::Now(); |
- if (current_time - start_time > base::TimeDelta::FromSeconds(10)) { |
- ADD_FAILURE() << "Condition not met within ten seconds."; |
- return false; |
- } |
- |
- base::MessageLoop::current()->task_runner()->PostDelayedTask( |
- FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), |
- base::TimeDelta::FromMilliseconds(20)); |
- content::RunMessageLoop(); |
- } |
- return true; |
-} |
- |
} // namespace |
// A BrowserTest that opens a test page that launches a simulated fullscreen |
@@ -88,11 +70,9 @@ class FlashFullscreenInteractiveBrowserTest : public OutOfProcessPPAPITest { |
content::WebContents* const old_tab_contents = GetActiveWebContents(); |
EXPECT_TRUE(ui_test_utils::SendKeyPressSync( |
browser(), ui::VKEY_T, !kIsMacUI, false, false, kIsMacUI)); |
- EXPECT_TRUE(RunLoopUntil(base::Bind( |
+ EXPECT_TRUE(ui_test_utils::RunLoopUntil(base::Bind( |
&FlashFullscreenInteractiveBrowserTest::IsObservingActiveWebContents, |
- base::Unretained(this), |
- old_tab_contents, |
- false))); |
+ base::Unretained(this), old_tab_contents, false))); |
} |
void UseAcceleratorToSwitchToTab(int tab_index) { |
@@ -101,11 +81,9 @@ class FlashFullscreenInteractiveBrowserTest : public OutOfProcessPPAPITest { |
static_cast<ui::KeyboardCode>(ui::VKEY_1 + tab_index); |
EXPECT_TRUE(ui_test_utils::SendKeyPressSync( |
browser(), key_code, !kIsMacUI, false, false, kIsMacUI)); |
- EXPECT_TRUE(RunLoopUntil(base::Bind( |
+ EXPECT_TRUE(ui_test_utils::RunLoopUntil(base::Bind( |
&FlashFullscreenInteractiveBrowserTest::IsObservingActiveWebContents, |
- base::Unretained(this), |
- old_tab_contents, |
- false))); |
+ base::Unretained(this), old_tab_contents, false))); |
} |
void PressEscape() { |
@@ -132,10 +110,9 @@ class FlashFullscreenInteractiveBrowserTest : public OutOfProcessPPAPITest { |
} |
bool ObserveTabIsInFullscreen(bool expected_in_fullscreen) const { |
- if (!RunLoopUntil(base::Bind( |
+ if (!ui_test_utils::RunLoopUntil(base::Bind( |
&FlashFullscreenInteractiveBrowserTest::IsObservingTabInFullscreen, |
- base::Unretained(this), |
- GetActiveWebContents(), |
+ base::Unretained(this), GetActiveWebContents(), |
expected_in_fullscreen))) |
return false; |
@@ -157,11 +134,9 @@ class FlashFullscreenInteractiveBrowserTest : public OutOfProcessPPAPITest { |
bool ObserveFlashHasFocus(content::WebContents* contents, |
bool expected_to_have_focus) const { |
- if (!RunLoopUntil(base::Bind( |
+ if (!ui_test_utils::RunLoopUntil(base::Bind( |
&FlashFullscreenInteractiveBrowserTest::IsObservingFlashHasFocus, |
- base::Unretained(this), |
- contents, |
- expected_to_have_focus))) |
+ base::Unretained(this), contents, expected_to_have_focus))) |
return false; |
if (expected_to_have_focus) { |
@@ -179,10 +154,9 @@ class FlashFullscreenInteractiveBrowserTest : public OutOfProcessPPAPITest { |
} |
bool ObserveFlashFillColor(SkColor expected_color) const { |
- return RunLoopUntil(base::Bind( |
+ return ui_test_utils::RunLoopUntil(base::Bind( |
&FlashFullscreenInteractiveBrowserTest::IsObservingFlashFillColor, |
- base::Unretained(this), |
- expected_color)); |
+ base::Unretained(this), expected_color)); |
} |
private: |