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

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

Issue 19957002: Run the later parts of startup as UI thread tasks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Run the later parts of startup as UI thread tasks - minor comment fixes Created 7 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser_test_base.h" 5 #include "content/public/test/browser_test_base.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/stack_trace.h" 9 #include "base/debug/stack_trace.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 command_line->AppendSwitch(switches::kSkipGpuDataLoading); 91 command_line->AppendSwitch(switches::kSkipGpuDataLoading);
92 92
93 MainFunctionParams params(*command_line); 93 MainFunctionParams params(*command_line);
94 params.ui_task = 94 params.ui_task =
95 new base::Closure( 95 new base::Closure(
96 base::Bind(&BrowserTestBase::ProxyRunTestOnMainThreadLoop, this)); 96 base::Bind(&BrowserTestBase::ProxyRunTestOnMainThreadLoop, this));
97 97
98 SetUpInProcessBrowserTestFixture(); 98 SetUpInProcessBrowserTestFixture();
99 #if defined(OS_ANDROID) 99 #if defined(OS_ANDROID)
100 BrowserMainRunner::Create()->Initialize(params); 100 scoped_refptr<content::StartupTaskRunner> startup_task_runner =
101 make_scoped_refptr(new content::StartupTaskRunner(
102 content::StartupTaskRunner::IMMEDIATE, NULL));
103
104 BrowserMainRunner::Create()->Initialize(params, startup_task_runner);
101 // We are done running the test by now. During teardown we 105 // We are done running the test by now. During teardown we
102 // need to be able to perform IO. 106 // need to be able to perform IO.
103 base::ThreadRestrictions::SetIOAllowed(true); 107 base::ThreadRestrictions::SetIOAllowed(true);
104 BrowserThread::PostTask( 108 BrowserThread::PostTask(
105 BrowserThread::IO, FROM_HERE, 109 BrowserThread::IO, FROM_HERE,
106 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), 110 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed),
107 true)); 111 true));
108 #else 112 #else
109 BrowserMain(params); 113 BrowserMain(params);
110 #endif 114 #endif
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 RenderProcessHostImpl::GetInProcessRendererThreadForTesting(); 147 RenderProcessHostImpl::GetInProcessRendererThreadForTesting();
144 CHECK(renderer_loop); 148 CHECK(renderer_loop);
145 149
146 renderer_loop->PostTask( 150 renderer_loop->PostTask(
147 FROM_HERE, 151 FROM_HERE,
148 base::Bind(&RunTaskOnRendererThread, task, runner->QuitClosure())); 152 base::Bind(&RunTaskOnRendererThread, task, runner->QuitClosure()));
149 runner->Run(); 153 runner->Run();
150 } 154 }
151 155
152 } // namespace content 156 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698