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

Side by Side Diff: chrome/test/data/local_ntp_browsertest.js

Issue 2695813012: [Local NTP] Add an integration test for the most visited iframe (Closed)
Patch Set: rebase 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/search/local_ntp_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 5
6 /** 6 /**
7 * @fileoverview Tests the local NTP. 7 * @fileoverview Tests the local NTP.
8 */ 8 */
9 9
10 10
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 assert(!window.chrome.embeddedSearch.newTabPage.getMostVisitedItemData( 132 assert(!window.chrome.embeddedSearch.newTabPage.getMostVisitedItemData(
133 window.chrome.embeddedSearch.newTabPage.mostVisited[0].rid)); 133 window.chrome.embeddedSearch.newTabPage.mostVisited[0].rid));
134 } 134 }
135 135
136 136
137 137
138 // ****************************** ADVANCED TESTS ****************************** 138 // ****************************** ADVANCED TESTS ******************************
139 // Advanced tests are controlled from the native side. The helpers here are 139 // Advanced tests are controlled from the native side. The helpers here are
140 // called from native code to set up the page and to check results. 140 // called from native code to set up the page and to check results.
141 141
142 function setupAdvancedTest() { 142 function handlePostMessage(event) {
143 if (event.data.cmd == 'loaded') {
144 domAutomationController.setAutomationId(0);
145 domAutomationController.send('loaded');
146 }
147 }
148
149 function setupAdvancedTest(opt_waitForIframeLoaded) {
150 if (opt_waitForIframeLoaded) {
151 window.addEventListener('message', handlePostMessage);
152 }
153
143 setUp(); 154 setUp();
144 initLocalNTP(/*isGooglePage=*/true); 155 initLocalNTP(/*isGooglePage=*/true);
145 156
146 assert(elementIsVisible($('fakebox'))); 157 assert(elementIsVisible($('fakebox')));
147 158
148 return true; 159 return true;
149 } 160 }
150 161
151 function getFakeboxPositionX() { 162 function getFakeboxPositionX() {
152 assert(elementIsVisible($('fakebox'))); 163 assert(elementIsVisible($('fakebox')));
153 var rect = $('fakebox').getBoundingClientRect(); 164 var rect = $('fakebox').getBoundingClientRect();
154 return rect.left; 165 return rect.left;
155 } 166 }
156 167
157 function getFakeboxPositionY() { 168 function getFakeboxPositionY() {
158 assert(elementIsVisible($('fakebox'))); 169 assert(elementIsVisible($('fakebox')));
159 var rect = $('fakebox').getBoundingClientRect(); 170 var rect = $('fakebox').getBoundingClientRect();
160 return rect.top; 171 return rect.top;
161 } 172 }
162 173
163 function fakeboxIsVisible() { 174 function fakeboxIsVisible() {
164 return elementIsVisible($('fakebox')); 175 return elementIsVisible($('fakebox'));
165 } 176 }
166 177
167 function fakeboxIsFocused() { 178 function fakeboxIsFocused() {
168 return fakeboxIsVisible() && 179 return fakeboxIsVisible() &&
169 document.body.classList.contains('fakebox-focused'); 180 document.body.classList.contains('fakebox-focused');
170 } 181 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/local_ntp_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698