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

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

Issue 2238163002: [MD History] Add UMA stats for switching views and the CBD button. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@start_focus_in_search_bar
Patch Set: rebase, vulcanize 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 resolve(); 105 resolve();
106 element.removeEventListener(eventName, listener); 106 element.removeEventListener(eventName, listener);
107 } 107 }
108 108
109 element.addEventListener(eventName, listener); 109 element.addEventListener(eventName, listener);
110 }); 110 });
111 } 111 }
112 112
113 /** 113 /**
114 * @return {Promise}
115 */
116 function waitForAnimationFrame() {
117 return new Promise(function(resolve) {
118 requestAnimationFrame(function() { setTimeout(resolve); });
119 });
120 }
121
122 /**
114 * Sends a shift click event to |element|. 123 * Sends a shift click event to |element|.
115 * @param {HTMLElement} element 124 * @param {HTMLElement} element
116 */ 125 */
117 function shiftClick(element) { 126 function shiftClick(element) {
118 var xy = MockInteractions.middleOfNode(element); 127 var xy = MockInteractions.middleOfNode(element);
119 var props = { 128 var props = {
120 bubbles: true, 129 bubbles: true,
121 cancelable: true, 130 cancelable: true,
122 clientX: xy.x, 131 clientX: xy.x,
123 clientY: xy.y, 132 clientY: xy.y,
124 buttons: 1, 133 buttons: 1,
125 shiftKey: true, 134 shiftKey: true,
126 }; 135 };
127 136
128 element.dispatchEvent(new MouseEvent('mousedown', props)); 137 element.dispatchEvent(new MouseEvent('mousedown', props));
129 element.dispatchEvent(new MouseEvent('mouseup', props)); 138 element.dispatchEvent(new MouseEvent('mouseup', props));
130 element.dispatchEvent(new MouseEvent('click', props)); 139 element.dispatchEvent(new MouseEvent('click', props));
131 } 140 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698