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

Unified Diff: chrome/browser/resources/local_ntp/local_ntp.js

Issue 19054012: Reload Local NTP on default search provider change. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 7 years, 5 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/resources/local_ntp/local_ntp.js
diff --git a/chrome/browser/resources/local_ntp/local_ntp.js b/chrome/browser/resources/local_ntp/local_ntp.js
index 6cdd6c529ecc9395520b344b78abb80fbef67376..da8640d33323ee810a3483e62dcca777087d6b51 100644
--- a/chrome/browser/resources/local_ntp/local_ntp.js
+++ b/chrome/browser/resources/local_ntp/local_ntp.js
@@ -9,10 +9,10 @@
/**
* Controls rendering the new tab page for InstantExtended.
- * @param {Object} location window.location or a mock.
+ * @param {Object} testData Mock data to test the local NTP.
* @return {Object} A limited interface for testing the local NTP.
*/
-function LocalNTP(location) {
+function LocalNTP(testData) {
<include src="../../../../ui/webui/resources/js/assert.js">
@@ -253,6 +253,13 @@ var NUM_ROWS = 2;
/**
+ * Mock data to test the local NTP.
+ * @type {Object}
+ * const
+ * */
+var mockTestData = testData;
+
+/**
* Minimum total padding to give to the left and right of the most visited
* section. Used to determine how many tiles to show.
* @type {number}
@@ -878,7 +885,10 @@ function getEmbeddedSearchApiHandle() {
* provider. Used to determine whether to show the logo and fakebox.
*/
function isGooglePage() {
- return location.href.indexOf('isGoogle') != -1;
+ if (window.localNTPUnitTest && mockTestData)
samarth 2013/07/12 17:16:06 Having a separate code path for the test kind of d
kmadhusu 2013/07/15 22:21:51 Fixed. Instead of modifying the codepath, I update
+ return mockTestData.isGooglePage;
+
+ return templateData.isGooglePage;
}
@@ -1014,5 +1024,5 @@ return {
}
if (!window.localNTPUnitTest) {
- LocalNTP(location).listen();
+ LocalNTP(undefined).listen();
}

Powered by Google App Engine
This is Rietveld 408576698