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

Side by Side Diff: chrome/browser/ui/webui/constrained_web_dialog_ui_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: Harmonize MessageLoop/TTRH usage. 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 (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 "base/callback.h" 5 #include "base/callback.h"
6 #include "base/location.h"
7 #include "base/single_thread_task_runner.h"
msw 2015/06/12 00:31:21 nit: remove sttr and ttrh headers.
Sami 2015/06/12 10:56:22 Done.
6 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
7 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/thread_task_runner_handle.h"
8 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/tabs/tab_strip_model.h" 13 #include "chrome/browser/ui/tabs/tab_strip_model.h"
11 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" 14 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h"
12 #include "chrome/common/url_constants.h" 15 #include "chrome/common/url_constants.h"
13 #include "chrome/test/base/in_process_browser_test.h" 16 #include "chrome/test/base/in_process_browser_test.h"
14 #include "components/web_modal/web_contents_modal_dialog_manager.h" 17 #include "components/web_modal/web_contents_modal_dialog_manager.h"
15 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
16 #include "content/public/browser/web_contents_observer.h" 19 #include "content/public/browser/web_contents_observer.h"
17 #include "content/public/test/browser_test_utils.h" 20 #include "content/public/test/browser_test_utils.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // Runs the current MessageLoop until |condition| is true or timeout. 71 // Runs the current MessageLoop until |condition| is true or timeout.
69 bool RunLoopUntil(const base::Callback<bool()>& condition) { 72 bool RunLoopUntil(const base::Callback<bool()>& condition) {
70 const base::TimeTicks start_time = base::TimeTicks::Now(); 73 const base::TimeTicks start_time = base::TimeTicks::Now();
71 while (!condition.Run()) { 74 while (!condition.Run()) {
72 const base::TimeTicks current_time = base::TimeTicks::Now(); 75 const base::TimeTicks current_time = base::TimeTicks::Now();
73 if (current_time - start_time > base::TimeDelta::FromSeconds(5)) { 76 if (current_time - start_time > base::TimeDelta::FromSeconds(5)) {
74 ADD_FAILURE() << "Condition not met within five seconds."; 77 ADD_FAILURE() << "Condition not met within five seconds.";
75 return false; 78 return false;
76 } 79 }
77 80
78 base::MessageLoop::current()->PostDelayedTask( 81 base::MessageLoop::current()->task_runner()->PostDelayedTask(
79 FROM_HERE, 82 FROM_HERE, base::MessageLoop::QuitClosure(),
80 base::MessageLoop::QuitClosure(),
81 base::TimeDelta::FromMilliseconds(20)); 83 base::TimeDelta::FromMilliseconds(20));
82 content::RunMessageLoop(); 84 content::RunMessageLoop();
83 } 85 }
84 return true; 86 return true;
85 } 87 }
86 88
87 protected: 89 protected:
88 bool IsShowingWebContentsModalDialog(WebContents* web_contents) const { 90 bool IsShowingWebContentsModalDialog(WebContents* web_contents) const {
89 WebContentsModalDialogManager* web_contents_modal_dialog_manager = 91 WebContentsModalDialogManager* web_contents_modal_dialog_manager =
90 WebContentsModalDialogManager::FromWebContents(web_contents); 92 WebContentsModalDialogManager::FromWebContents(web_contents);
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 253
252 // Resize <body> to dimension larger than dialog. 254 // Resize <body> to dimension larger than dialog.
253 EXPECT_TRUE(ExecuteScript(dialog_delegate->GetWebContents(), 255 EXPECT_TRUE(ExecuteScript(dialog_delegate->GetWebContents(),
254 GetChangeDimensionsScript(500))); 256 GetChangeDimensionsScript(500)));
255 ASSERT_TRUE(RunLoopUntil(base::Bind( 257 ASSERT_TRUE(RunLoopUntil(base::Bind(
256 &IsEqualSizes, 258 &IsEqualSizes,
257 initial_dialog_size, 259 initial_dialog_size,
258 dialog_delegate))); 260 dialog_delegate)));
259 } 261 }
260 #endif // !OS_MACOSX 262 #endif // !OS_MACOSX
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698