Commit e58a60fa authored by Devlin Cronin's avatar Devlin Cronin Committed by Commit Bot

[Extensions] De-flake BrowserActionApiTest.CloseBackgroundPage

De-flake BrowserActionApiTest.CloseBackgroundPage. The test could fail
if the C++ side clicked on the browser action icon before the extension
registered a listener for browserAction.onClicked(). If this happened,
the event would be dropped, and the test would time out waiting for the
extension host to close.

Fix this by waiting for the extension to send a "ready" message when it
has finished setting up listeners.

The test now passes 100 runs on the bots with no flakes (before, it
would flake multiple times on 100 runs).

Bug: 1035075

Change-Id: Ic56ff1026b68db8cd5296098f719b660ad7a4918
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1981835Reviewed-by: default avatarIstiaque Ahmed <lazyboy@chromium.org>
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#727593}
parent 377025ec
......@@ -769,9 +769,11 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, IncognitoSplit) {
}
IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, CloseBackgroundPage) {
ExtensionTestMessageListener listener("ready", /*will_reply=*/false);
ASSERT_TRUE(LoadExtension(
test_data_dir_.AppendASCII("browser_action/close_background")));
const Extension* extension = GetSingleLoadedExtension();
ASSERT_TRUE(listener.WaitUntilSatisfied());
// There is a background page and a browser action with no badge text.
extensions::ProcessManager* manager =
......
......@@ -7,3 +7,5 @@ chrome.browserAction.onClicked.addListener(function(tab) {
window.close();
});
});
chrome.test.sendMessage('ready');
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment