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

Unified Diff: chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc

Issue 19045002: Use Blink support to watch CSS selectors directly instead of using a MutationObserver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unCamelCase in Chrome code. Created 7 years, 2 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 | « no previous file | chrome/chrome_renderer.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc b/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc
index 1c9b3af46f7a5234ad49fd12d538c3942b798adf..b6bbc8cea4da49171da7d07f97f773b088a84c17 100644
--- a/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc
+++ b/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc
@@ -96,8 +96,10 @@ IN_PROC_BROWSER_TEST_F(DeclarativeContentApiTest, Overview) {
// Insert a password field to make sure that's noticed.
ASSERT_TRUE(content::ExecuteScript(
tab, "document.body.innerHTML = '<input type=\"password\">';"));
- // Give the mutation observer a chance to run and send back the
- // matching-selector update.
+ // 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.
+ 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.";
@@ -105,8 +107,9 @@ IN_PROC_BROWSER_TEST_F(DeclarativeContentApiTest, Overview) {
// Remove it again to make sure that reverts the action.
ASSERT_TRUE(content::ExecuteScript(
tab, "document.body.innerHTML = 'Hello world';"));
- // Give the mutation observer a chance to run and send back the
- // matching-selector update.
+ // Give the style match a chance to run and send back the
+ // matching-selector update. This also takes 2 iterations.
+ 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.";
@@ -155,7 +158,10 @@ IN_PROC_BROWSER_TEST_F(DeclarativeContentApiTest,
" actions: [new ShowPageAction()]\n"
"}], 'rule0');\n"));
// Give the renderer a chance to apply the rules change and notify the
- // browser.
+ // browser. This takes one time through the Blink message loop to receive
+ // the rule change and apply the new stylesheet, and a second to dedupe the
+ // update.
+ ASSERT_TRUE(content::ExecuteScript(tab, std::string()));
ASSERT_TRUE(content::ExecuteScript(tab, std::string()));
EXPECT_FALSE(tab->IsCrashed());
« no previous file with comments | « no previous file | chrome/chrome_renderer.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698