EXPECT_FALSE(page_action->GetIsVisible(tab_id));
// Insert a password field to make sure that's noticed.
+ // Notice that we touch offsetTop to force a synchronous layout.
ASSERT_TRUE(content::ExecuteScript(
- tab, "document.body.innerHTML = '<input type=\"password\">';"));
+ tab, "document.body.innerHTML = '<input type=\"password\">';"
+ "document.body.offsetTop;"));
+
// Give the style match a chance to run and send back the matching-selector
// update. This takes one time through the Blink message loop to apply the
// style to the new element, and a second to dedupe updates.
+ // FIXME: Remove this after https://codereview.chromium.org/145663012/
ASSERT_TRUE(content::ExecuteScript(tab, std::string()));
ASSERT_TRUE(content::ExecuteScript(tab, std::string()));
+
EXPECT_TRUE(page_action->GetIsVisible(tab_id))
<< "Adding a matching element should show the page action.";
// Remove it again to make sure that reverts the action.
+ // Notice that we touch offsetTop to force a synchronous layout.
ASSERT_TRUE(content::ExecuteScript(
- tab, "document.body.innerHTML = 'Hello world';"));
- // Give the style match a chance to run and send back the
- // matching-selector update. This also takes 2 iterations.
+ tab, "document.body.innerHTML = 'Hello world';"
+ "document.body.offsetTop;"));
+
+ // Give the style match a chance to run and send back the matching-selector
+ // update. This takes one time through the Blink message loop to apply the
+ // style to the new element, and a second to dedupe updates.
+ // FIXME: Remove this after https://codereview.chromium.org/145663012/
ASSERT_TRUE(content::ExecuteScript(tab, std::string()));
ASSERT_TRUE(content::ExecuteScript(tab, std::string()));
+
EXPECT_FALSE(page_action->GetIsVisible(tab_id))
<< "Removing the matching element should hide the page action again.";
}
// This tests against a renderer crash that was present during development.
IN_PROC_BROWSER_TEST_F(DeclarativeContentApiTest,
- AddExtensionMatchingExistingTabWithDeadFrames) {
+ DISABLED_AddExtensionMatchingExistingTabWithDeadFrames) {
ext_dir_.WriteManifest(kDeclarativeContentManifest);
ext_dir_.WriteFile(FILE_PATH_LITERAL("background.js"), kBackgroundHelpers);
content::WebContents* const tab =