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

Side by Side Diff: chrome/test/base/test_web_dialog_observer.cc

Issue 10479018: Add base::RunLoop and update ui_test_utils to use it to reduce flakiness (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: phajdan feedback Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chrome/test/base/test_web_dialog_observer.h ('k') | chrome/test/base/testing_profile.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/test/base/test_web_dialog_observer.h" 5 #include "chrome/test/base/test_web_dialog_observer.h"
6 6
7 #include "chrome/test/base/ui_test_utils.h" 7 #include "chrome/test/base/ui_test_utils.h"
8 #include "content/public/browser/notification_service.h" 8 #include "content/public/browser/notification_service.h"
9 #include "content/public/browser/navigation_controller.h" 9 #include "content/public/browser/navigation_controller.h"
10 #include "content/public/browser/notification_details.h" 10 #include "content/public/browser/notification_details.h"
(...skipping 24 matching lines...) Expand all
35 break; 35 break;
36 case content::NOTIFICATION_LOAD_STOP: 36 case content::NOTIFICATION_LOAD_STOP:
37 DCHECK(web_ui_); 37 DCHECK(web_ui_);
38 registrar_.Remove(this, content::NOTIFICATION_LOAD_STOP, 38 registrar_.Remove(this, content::NOTIFICATION_LOAD_STOP,
39 content::Source<NavigationController>( 39 content::Source<NavigationController>(
40 &web_ui_->GetWebContents()->GetController())); 40 &web_ui_->GetWebContents()->GetController()));
41 done_ = true; 41 done_ = true;
42 // If the message loop is running stop it. 42 // If the message loop is running stop it.
43 if (running_) { 43 if (running_) {
44 running_ = false; 44 running_ = false;
45 MessageLoopForUI::current()->Quit(); 45 message_loop_runner_->Quit();
46 } 46 }
47 break; 47 break;
48 default: 48 default:
49 NOTREACHED(); 49 NOTREACHED();
50 }; 50 };
51 } 51 }
52 52
53 void TestWebDialogObserver::OnDialogShown( 53 void TestWebDialogObserver::OnDialogShown(
54 content::WebUI* webui, 54 content::WebUI* webui,
55 content::RenderViewHost* render_view_host) { 55 content::RenderViewHost* render_view_host) {
(...skipping 10 matching lines...) Expand all
66 // navigate in this method, ensuring that this is not a race condition. 66 // navigate in this method, ensuring that this is not a race condition.
67 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, 67 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP,
68 content::Source<NavigationController>( 68 content::Source<NavigationController>(
69 &web_ui_->GetWebContents()->GetController())); 69 &web_ui_->GetWebContents()->GetController()));
70 } 70 }
71 71
72 content::WebUI* TestWebDialogObserver::GetWebUI() { 72 content::WebUI* TestWebDialogObserver::GetWebUI() {
73 if (!done_) { 73 if (!done_) {
74 EXPECT_FALSE(running_); 74 EXPECT_FALSE(running_);
75 running_ = true; 75 running_ = true;
76 ui_test_utils::RunMessageLoop(); 76 message_loop_runner_ = new ui_test_utils::MessageLoopRunner;
77 message_loop_runner_->Run();
77 } 78 }
78 return web_ui_; 79 return web_ui_;
79 } 80 }
OLDNEW
« no previous file with comments | « chrome/test/base/test_web_dialog_observer.h ('k') | chrome/test/base/testing_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698