From 17e5753ea2e213295dc6a959be2ff286082faacd Mon Sep 17 00:00:00 2001 From: alexmos Date: Fri, 14 Aug 2015 19:54:36 -0700 Subject: Fix flakiness in postMessage-related SitePerProcessBrowserTests. See https://crbug.com/518729 for the complete description. This CL fixes two underlying issues for flakiness in SitePerProcessBrowserTest.PostMessageWithSubframeOnOpenerChain: 1. ExecuteScript* wasn't properly dealing with domAutomationController messages that might have arrived right after the expected response to ExecuteScript*, but before its message loop shut down. 2. DOMMessageQueue was instantiated after the ExecuteScript* in the test, causing it to never see the message it was waiting for if it happened to arrive on ExecuteScript's message loop above. BUG=518729 Review URL: https://codereview.chromium.org/1297713004 Cr-Commit-Position: refs/heads/master@{#343548} --- content/public/test/browser_test_utils.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'content/public/test') diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc index 6042396..214b2fd 100644 --- a/content/public/test/browser_test_utils.cc +++ b/content/public/test/browser_test_utils.cc @@ -75,9 +75,11 @@ class DOMOperationObserver : public NotificationObserver, const NotificationDetails& details) override { DCHECK(type == NOTIFICATION_DOM_OPERATION_RESPONSE); Details dom_op_details(details); - response_ = dom_op_details->json; - did_respond_ = true; - message_loop_runner_->Quit(); + if (!did_respond_) { + response_ = dom_op_details->json; + did_respond_ = true; + message_loop_runner_->Quit(); + } } // Overridden from WebContentsObserver: -- cgit v1.1