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

Unified Diff: chrome/browser/extensions/native_bindings_apitest.cc

Issue 2853023002: [Extensions Bindings] Add native declarativeContent verification (Closed)
Patch Set: jbroman's Created 3 years, 8 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
Index: chrome/browser/extensions/native_bindings_apitest.cc
diff --git a/chrome/browser/extensions/native_bindings_apitest.cc b/chrome/browser/extensions/native_bindings_apitest.cc
index c19ec638f0d378eb0eeb2325c8276c0cdaf80f4e..e1edfb1177ff7866467f0429799b5f5ad87667ac 100644
--- a/chrome/browser/extensions/native_bindings_apitest.cc
+++ b/chrome/browser/extensions/native_bindings_apitest.cc
@@ -76,10 +76,15 @@ IN_PROC_BROWSER_TEST_F(NativeBindingsApiTest, DeclarativeEvents) {
host_resolver()->AddRule("*", "127.0.0.1");
embedded_test_server()->ServeFilesFromDirectory(test_data_dir_);
ASSERT_TRUE(StartEmbeddedTestServer());
- // Load an extension and wait for it to be ready.
+ // Load an extension. On load, this extension will a) run a few simple tests
+ // using chrome.test.runTests() and b) set up rules for declarative events for
+ // a browser-driven test. Wait for both the tests to finish and the extension
+ // to be ready.
ExtensionTestMessageListener listener("ready", false);
+ ResultCatcher catcher;
const Extension* extension = LoadExtension(
test_data_dir_.AppendASCII("native_bindings/declarative_content"));
+ ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
ASSERT_TRUE(extension);
ASSERT_TRUE(listener.WaitUntilSatisfied());
@@ -90,6 +95,7 @@ IN_PROC_BROWSER_TEST_F(NativeBindingsApiTest, DeclarativeEvents) {
browser()->tab_strip_model()->GetActiveWebContents();
int tab_id = SessionTabHelper::IdForTab(web_contents);
EXPECT_FALSE(page_action->GetIsVisible(tab_id));
+ EXPECT_TRUE(page_action->GetDeclarativeIcon(tab_id).IsEmpty());
// Navigating to example.com should show the page action.
ui_test_utils::NavigateToURL(
@@ -97,6 +103,7 @@ IN_PROC_BROWSER_TEST_F(NativeBindingsApiTest, DeclarativeEvents) {
"example.com", "/native_bindings/simple.html"));
base::RunLoop().RunUntilIdle();
EXPECT_TRUE(page_action->GetIsVisible(tab_id));
+ EXPECT_FALSE(page_action->GetDeclarativeIcon(tab_id).IsEmpty());
// And the extension should be notified of the click.
ExtensionTestMessageListener clicked_listener("clicked and removed", false);

Powered by Google App Engine
This is Rietveld 408576698