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

Side by Side Diff: content/public/test/render_view_test.cc

Issue 2852373004: Use ScopedTaskEnvironment instead of MessageLoop in tests that use v8. (Closed)
Patch Set: CR-gab-12 Created 3 years, 7 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 "content/public/test/render_view_test.h" 5 #include "content/public/test/render_view_test.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cctype> 9 #include <cctype>
10 10
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 149 }
150 150
151 RenderViewTest::RenderViewTest() 151 RenderViewTest::RenderViewTest()
152 : view_(NULL) { 152 : view_(NULL) {
153 RenderFrameImpl::InstallCreateHook(&TestRenderFrame::CreateTestRenderFrame); 153 RenderFrameImpl::InstallCreateHook(&TestRenderFrame::CreateTestRenderFrame);
154 } 154 }
155 155
156 RenderViewTest::~RenderViewTest() { 156 RenderViewTest::~RenderViewTest() {
157 } 157 }
158 158
159 void RenderViewTest::ProcessPendingMessages() { 159 void RenderViewTest::ProcessPendingMessages() {
sky 2017/05/04 02:58:55 How about removing this function entirely and havi
fdoray 2017/05/08 15:22:08 Done in a separate CL https://codereview.chromium.
160 msg_loop_.task_runner()->PostTask(FROM_HERE, 160 base::RunLoop().RunUntilIdle();
161 base::MessageLoop::QuitWhenIdleClosure());
162 base::RunLoop().Run();
163 } 161 }
164 162
165 WebLocalFrame* RenderViewTest::GetMainFrame() { 163 WebLocalFrame* RenderViewTest::GetMainFrame() {
166 return view_->GetWebView()->MainFrame()->ToWebLocalFrame(); 164 return view_->GetWebView()->MainFrame()->ToWebLocalFrame();
167 } 165 }
168 166
169 void RenderViewTest::ExecuteJavaScriptForTests(const char* js) { 167 void RenderViewTest::ExecuteJavaScriptForTests(const char* js) {
170 GetMainFrame()->ExecuteScript(WebScriptSource(WebString::FromUTF8(js))); 168 GetMainFrame()->ExecuteScript(WebScriptSource(WebString::FromUTF8(js)));
171 } 169 }
172 170
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); 666 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame());
669 frame->Navigate(common_params, StartNavigationParams(), request_params); 667 frame->Navigate(common_params, StartNavigationParams(), request_params);
670 668
671 // The load actually happens asynchronously, so we pump messages to process 669 // The load actually happens asynchronously, so we pump messages to process
672 // the pending continuation. 670 // the pending continuation.
673 FrameLoadWaiter(frame).Wait(); 671 FrameLoadWaiter(frame).Wait();
674 view_->GetWebView()->UpdateAllLifecyclePhases(); 672 view_->GetWebView()->UpdateAllLifecyclePhases();
675 } 673 }
676 674
677 } // namespace content 675 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698