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

Unified Diff: chrome/test/data/local_ntp_browsertest.js

Issue 2703613002: [Local NTP] Add a simple test for embeddedSearch.newTabPage.mostVisited (Closed)
Patch Set: Created 3 years, 10 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/local_ntp_browsertest.js
diff --git a/chrome/test/data/local_ntp_browsertest.js b/chrome/test/data/local_ntp_browsertest.js
index 13bd93c5853527cb4c29136d4ab53d5ae1328e4c..bb33e34723b31565c1c0e50d3d98153131c9c2c1 100644
--- a/chrome/test/data/local_ntp_browsertest.js
+++ b/chrome/test/data/local_ntp_browsertest.js
@@ -108,6 +108,32 @@ function testDoesNotShowFakeboxIfNotGoogle() {
}
+/**
+ * Tests that the embeddedSearch.newTabPage.mostVisited API is hooked up, and
+ * provides the correct data for the tiles (i.e. only IDs, no URLs).
+ */
+function testMostVisitedContents() {
+ // Check that the API is available and properly hooked up, so that it returns
+ // some data (see history::PrepopulatedPageList for the default contents).
+ assert(window.chrome.embeddedSearch.newTabPage.mostVisited.length > 0);
+
+ // Check that the items have the required fields: We expect a "restricted ID"
+ // (rid), but there mustn't be url, title, etc. Those are only available
+ // through getMostVisitedItemData(rid).
+ for (var mvItem of window.chrome.embeddedSearch.newTabPage.mostVisited) {
+ assert(isFinite(mvItem.rid));
+ assert(!mvItem.url);
+ assert(!mvItem.title);
+ assert(!mvItem.domain);
+ }
+
+ // Try to get an item's details via getMostVisitedItemData. This should fail,
+ // because that API is only available to the MV iframe.
+ assert(!window.chrome.embeddedSearch.newTabPage.getMostVisitedItemData(
+ window.chrome.embeddedSearch.newTabPage.mostVisited[0].rid));
+}
+
+
// ****************************** ADVANCED TESTS ******************************
// Advanced tests are controlled from the native side. The helpers here are
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698