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

Side by Side Diff: chrome/test/data/webui/md_history/test_util.js

Issue 2255033002: [MD History] Copy stats from the old history page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sidebar_stats
Patch Set: rebase Created 4 years, 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 * Waits for queued up tasks to finish before proceeding. Inspired by: 6 * Waits for queued up tasks to finish before proceeding. Inspired by:
7 * https://github.com/Polymer/web-component-tester/blob/master/browser/environme nt/helpers.js#L97 7 * https://github.com/Polymer/web-component-tester/blob/master/browser/environme nt/helpers.js#L97
8 */ 8 */
9 function flush() { 9 function flush() {
10 Polymer.dom.flush(); 10 Polymer.dom.flush();
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 clientX: xy.x, 122 clientX: xy.x,
123 clientY: xy.y, 123 clientY: xy.y,
124 buttons: 1, 124 buttons: 1,
125 shiftKey: true, 125 shiftKey: true,
126 }; 126 };
127 127
128 element.dispatchEvent(new MouseEvent('mousedown', props)); 128 element.dispatchEvent(new MouseEvent('mousedown', props));
129 element.dispatchEvent(new MouseEvent('mouseup', props)); 129 element.dispatchEvent(new MouseEvent('mouseup', props));
130 element.dispatchEvent(new MouseEvent('click', props)); 130 element.dispatchEvent(new MouseEvent('click', props));
131 } 131 }
132
133 function disableLinkClicks() {
134 document.addEventListener('click', function(e) {
135 if (e.defaultPrevented)
136 return;
137
138 var eventPath = e.path;
139 var anchor = null;
140 if (eventPath) {
141 for (var i = 0; i < eventPath.length; i++) {
142 var element = eventPath[i];
143 if (element.tagName === 'A' && element.href) {
144 anchor = element;
145 break;
146 }
147 }
148 }
149
150 if (!anchor)
151 return;
152
153 e.preventDefault();
154 });
155 }
156
157 function createSession(name, windows) {
158 return {
159 collapsed: false,
160 deviceType: '',
161 name: name,
162 modifiedTime: '2 seconds ago',
163 tag: name,
164 timestamp: 0,
165 windows: windows
166 };
167 }
168
169 function createWindow(tabUrls) {
170 var tabs = tabUrls.map(function(tabUrl) {
171 return {sessionId: 456, timestamp: 0, title: tabUrl, url: tabUrl};
172 });
173
174 return {
175 tabs: tabs,
176 sessionId: '123',
177 userVisibleTimestamp: "A while ago"
178 };
179 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698