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

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

Issue 2853023002: [Extensions Bindings] Add native declarativeContent verification (Closed)
Patch Set: lazyboy'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 c3b9aa342405d7eb8868d0850cdeb8f144b1b5e9..9508c4c3b9d2b61015a816e44a59de66647e561e 100644
--- a/chrome/browser/extensions/native_bindings_apitest.cc
+++ b/chrome/browser/extensions/native_bindings_apitest.cc
@@ -79,10 +79,15 @@ IN_PROC_BROWSER_TEST_F(NativeBindingsApiTest, SimpleAppTest) {
IN_PROC_BROWSER_TEST_F(NativeBindingsApiTest, DeclarativeEvents) {
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());
@@ -93,6 +98,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(
@@ -100,6 +106,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