Chromium Code Reviews| 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(); |
| } |