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

Side by Side Diff: ios/web/public/test/web_test_with_web_state.mm

Issue 2361203002: Remove calls to MessageLoop::Run/RunUntilIdle. (Closed)
Patch Set: CR jochen #6 Created 4 years, 2 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #import "ios/web/public/test/web_test_with_web_state.h" 5 #import "ios/web/public/test/web_test_with_web_state.h"
6 6
7 #include "base/run_loop.h"
7 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
8 #include "base/test/ios/wait_util.h" 9 #include "base/test/ios/wait_util.h"
9 #import "ios/web/public/web_state/url_verification_constants.h" 10 #import "ios/web/public/web_state/url_verification_constants.h"
10 #include "ios/web/public/web_state/web_state_observer.h" 11 #include "ios/web/public/web_state/web_state_observer.h"
11 #import "ios/web/web_state/ui/crw_web_controller.h" 12 #import "ios/web/web_state/ui/crw_web_controller.h"
12 #import "ios/web/web_state/web_state_impl.h" 13 #import "ios/web/web_state/web_state_impl.h"
13 14
14 namespace { 15 namespace {
15 // Returns CRWWebController for the given |web_state|. 16 // Returns CRWWebController for the given |web_state|.
16 CRWWebController* GetWebController(web::WebState* web_state) { 17 CRWWebController* GetWebController(web::WebState* web_state) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 activitySeen = false; 97 activitySeen = false;
97 98
98 // Yield to the iOS message queue, e.g. [NSObject performSelector:] events. 99 // Yield to the iOS message queue, e.g. [NSObject performSelector:] events.
99 if (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, true) == 100 if (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, true) ==
100 kCFRunLoopRunHandledSource) 101 kCFRunLoopRunHandledSource)
101 activitySeen = true; 102 activitySeen = true;
102 103
103 // Yield to the Chromium message queue, e.g. WebThread::PostTask() 104 // Yield to the Chromium message queue, e.g. WebThread::PostTask()
104 // events. 105 // events.
105 processed_a_task_ = false; 106 processed_a_task_ = false;
106 messageLoop->RunUntilIdle(); 107 base::RunLoop().RunUntilIdle();
107 if (processed_a_task_) // Set in TaskObserver method. 108 if (processed_a_task_) // Set in TaskObserver method.
108 activitySeen = true; 109 activitySeen = true;
109 110
110 } while (activitySeen); 111 } while (activitySeen);
111 messageLoop->RemoveTaskObserver(this); 112 messageLoop->RemoveTaskObserver(this);
112 } 113 }
113 114
114 void WebTestWithWebState::WaitForCondition(ConditionBlock condition) { 115 void WebTestWithWebState::WaitForCondition(ConditionBlock condition) {
115 base::MessageLoop* messageLoop = base::MessageLoop::current(); 116 base::MessageLoop* messageLoop = base::MessageLoop::current();
116 DCHECK(messageLoop); 117 DCHECK(messageLoop);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 149
149 void WebTestWithWebState::WillProcessTask(const base::PendingTask&) { 150 void WebTestWithWebState::WillProcessTask(const base::PendingTask&) {
150 // Nothing to do. 151 // Nothing to do.
151 } 152 }
152 153
153 void WebTestWithWebState::DidProcessTask(const base::PendingTask&) { 154 void WebTestWithWebState::DidProcessTask(const base::PendingTask&) {
154 processed_a_task_ = true; 155 processed_a_task_ = true;
155 } 156 }
156 157
157 } // namespace web 158 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/net/request_tracker_impl_unittest.mm ('k') | media/audio/android/audio_android_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698