Bug 1402921 - Enhance browser_ext_tabs_readerMode to verify that correct isInReaderMode is reported for onUpdated, r=Gijs,mixedpuppy
authorBob Silverberg <bsilverberg@mozilla.com>
Thu, 28 Sep 2017 07:37:35 -0400
changeset 679084 fb216e2b987078d7f79d2319072430292be3bc7e
parent 679083 785914e661d7b61eebd529ad5761fbaff2b64aea
child 679085 4e1474612b6402a3cbc70f9e5fcc449d37be018c
push id84141
push userbmo:schien@mozilla.com
push dateThu, 12 Oct 2017 11:13:04 +0000
reviewersGijs, mixedpuppy
bugs1402921
milestone58.0a1
Bug 1402921 - Enhance browser_ext_tabs_readerMode to verify that correct isInReaderMode is reported for onUpdated, r=Gijs,mixedpuppy All of the information needed for an extension to watch for tabs moving in and out of reader mode is already available in the onUpdated event. This adds some asserts to the existing test to check that this information is accurate. MozReview-Commit-ID: 7OkR933MUPl
browser/components/extensions/test/browser/browser_ext_tabs_readerMode.js
--- a/browser/components/extensions/test/browser/browser_ext_tabs_readerMode.js
+++ b/browser/components/extensions/test/browser/browser_ext_tabs_readerMode.js
@@ -81,23 +81,26 @@ add_task(async function test_reader_mode
   let tab = await extension.awaitMessage("isArticle");
 
   ok(!tab.url.startsWith(READER_MODE_PREFIX), "Tab url does not indicate reader mode.");
   ok(tab.isArticle, "Tab is readerable.");
 
   extension.sendMessage("enterReaderMode", true);
   tab = await extension.awaitMessage("tabUpdated");
   ok(tab.url.startsWith(READER_MODE_PREFIX), "Tab url indicates reader mode.");
+  ok(tab.isInReaderMode, "tab.isInReaderMode indicates reader mode.");
 
   extension.sendMessage("leaveReaderMode");
   tab = await extension.awaitMessage("tabUpdated");
   ok(!tab.url.startsWith(READER_MODE_PREFIX), "Tab url does not indicate reader mode.");
+  ok(!tab.isInReaderMode, "tab.isInReaderMode does not indicate reader mode.");
 
   extension.sendMessage("updateUrl", false, `${TEST_PATH}readerModeNonArticle.html`);
   tab = await extension.awaitMessage("tabUpdated");
   ok(!tab.url.startsWith(READER_MODE_PREFIX), "Tab url does not indicate reader mode.");
   ok(!tab.isArticle, "Tab is not readerable.");
+  ok(!tab.isInReaderMode, "tab.isInReaderMode does not indicate reader mode.");
 
   extension.sendMessage("enterReaderMode", false);
   await extension.awaitMessage("enterFailed");
 
   await extension.unload();
 });