Chromium Code Reviews| Index: chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc |
| diff --git a/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc b/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc |
| index b2143f955f0ed97186be96aa7e197e33212a2916..6f1aa74ce434db0ef736523c665f95d0587abe76 100644 |
| --- a/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc |
| +++ b/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc |
| @@ -21,6 +21,7 @@ |
| #include "content/public/browser/render_widget_host_iterator.h" |
| #include "content/public/browser/web_contents.h" |
| #include "content/public/browser/web_contents_observer.h" |
| +#include "content/public/test/browser_test_utils.h" |
| using content::RenderViewHost; |
| using content::RenderWidgetHost; |
| @@ -72,6 +73,7 @@ class ChromeRenderProcessHostTest : public InProcessBrowserTest { |
| CHECK(wc->GetURL() == page); |
| WaitForLauncherThread(); |
| + WaitForMessageProcessing(wc); |
| return wc->GetRenderProcessHost()->GetHandle(); |
| } |
| @@ -87,6 +89,7 @@ class ChromeRenderProcessHostTest : public InProcessBrowserTest { |
| CHECK(wc->GetVisibleURL() == page); |
| WaitForLauncherThread(); |
| + WaitForMessageProcessing(wc); |
| return wc->GetRenderProcessHost()->GetHandle(); |
| } |
| @@ -98,6 +101,15 @@ class ChromeRenderProcessHostTest : public InProcessBrowserTest { |
| base::MessageLoop::current()->Run(); |
| } |
| + // Implicitly waits for the given WebContents to process outstanding IPC |
| + // messages by running some JavaScript and waiting for the result. |
|
jam
2014/06/04 01:06:05
this comment is a bit misleading; afaik you're wai
DaleCurtis
2014/06/04 01:10:18
Done.
|
| + void WaitForMessageProcessing(WebContents* wc) { |
| + bool result = false; |
| + ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
| + wc, "window.domAutomationController.send(true);", &result)); |
| + ASSERT_TRUE(result); |
| + } |
| + |
| // When we hit the max number of renderers, verify that the way we do process |
| // sharing behaves correctly. In particular, this test is verifying that even |
| // when we hit the max process limit, that renderers of each type will wind up |
| @@ -252,9 +264,7 @@ IN_PROC_BROWSER_TEST_F(ChromeRenderProcessHostTest, ProcessPerTab) { |
| // We don't change process priorities on Mac or Posix because the user lacks the |
| // permission to raise a process' priority even after lowering it. |
| -// TODO(dalecurtis): Reenable this on Windows after figuring out how to reliably |
| -// wait for the renderer process to process IPC messages. |
| -#if defined(OS_LINUX) |
| +#if defined(OS_WIN) || defined(OS_LINUX) |
| IN_PROC_BROWSER_TEST_F(ChromeRenderProcessHostTest, Backgrounding) { |
| if (!base::Process::CanBackgroundProcesses()) { |
| LOG(ERROR) << "Can't background processes"; |