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

Unified Diff: content/public/test/browser_test_base.cc

Issue 14304004: Convert a bunch of test_shell_tests to content_browsertests. These are tests that depend on loading… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/test/browser_test_base.h ('k') | content/renderer/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/browser_test_base.cc
===================================================================
--- content/public/test/browser_test_base.cc (revision 195684)
+++ content/public/test/browser_test_base.cc (working copy)
@@ -8,8 +8,11 @@
#include "base/command_line.h"
#include "base/debug/stack_trace.h"
#include "base/process_util.h"
+#include "content/browser/renderer_host/render_process_host_impl.h"
+#include "content/public/browser/browser_thread.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/main_function_params.h"
+#include "content/public/test/test_utils.h"
#if defined(OS_MACOSX)
#include "base/mac/mac_util.h"
@@ -22,6 +25,7 @@
#include "content/public/browser/browser_thread.h"
#endif
+namespace content {
namespace {
#if defined(OS_POSIX)
@@ -43,12 +47,16 @@
}
#endif // defined(OS_POSIX)
+void RunTaskOnRendererThread(const base::Closure& task,
+ const base::Closure& quit_task) {
+ task.Run();
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, quit_task);
+}
+
} // namespace
-namespace content {
+extern int BrowserMain(const MainFunctionParams&);
-extern int BrowserMain(const content::MainFunctionParams&);
-
BrowserTestBase::BrowserTestBase() {
#if defined(OS_MACOSX)
base::mac::SetOverrideAmIBundled(true);
@@ -120,4 +128,20 @@
test_server_base));
}
+void BrowserTestBase::PostTaskToInProcessRendererAndWait(
+ const base::Closure& task) {
+ CHECK(CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess));
+
+ scoped_refptr<MessageLoopRunner> runner = new MessageLoopRunner;
+
+ base::MessageLoop* renderer_loop =
+ RenderProcessHostImpl::GetInProcessRendererThreadForTesting();
+ CHECK(renderer_loop);
+
+ renderer_loop->PostTask(
+ FROM_HERE,
+ base::Bind(&RunTaskOnRendererThread, task, runner->QuitClosure()));
+ runner->Run();
+}
+
} // namespace content
« no previous file with comments | « content/public/test/browser_test_base.h ('k') | content/renderer/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698