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

Side by Side Diff: ios/chrome/browser/ui/contextual_search/resources/contextualsearch_unittest.js

Issue 2553563004: [ios] Adds JS resources for various features. (Closed)
Patch Set: Upload. Created 4 years 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 /**
6 * @fileoverview Support code for the Contextual Search unittests feature.
7 *
8 */
9
10
11 /**
12 * Namespace for this file. Depends on __gCrWeb['contextualSearch'] having
13 * already been injected.
14 */
15 __gCrWeb['contextualSearch_unittest'] = {};
16
17 /* Anyonymizing block */
18 new function() {
19
20 /**
21 * Generate a tap event on an element. Remove the span arround the element.
22 * @param {string} elementID The ID of the element to tap.
23 * @return {object} Empty if element did not trigger CS. Else, the CS context.
24 */
25 __gCrWeb['contextualSearch'].tapOnElement = function(elementID) {
26 var element = document.getElementById(elementID);
27 if (element) {
28 var rect = element.getBoundingClientRect();
29 var relativeX = (rect.left + document.body.scrollLeft);
30 var relativeY = (rect.top + document.body.scrollTop);
31 var touch = document.createEvent('TouchEvent');
32 touch.initUIEvent('touchend', true, true);
33 element.dispatchEvent(touch);
34 return __gCrWeb.contextualSearch.handleTapAtPoint(
35 (relativeX + rect.width / 2) / document.documentElement.scrollWidth,
36 (relativeY + rect.height / 2) / document.documentElement.scrollHeight);
37 }
38 return null;
39 };
40
41 /* Anyonymizing block end */
42 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/contextual_search/resources/contextualsearch.js ('k') | ios/chrome/browser/ui/downloads/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698