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

Side by Side Diff: chrome/test/data/extensions/api_test/automation/tests/tabs/events.js

Issue 273323002: Convert snakecase enum names to camelcase when stringified. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: final changes Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 var allTests = [ 5 var allTests = [
6 function testEventListenerTarget() { 6 function testEventListenerTarget() {
7 var cancelButton = tree.root.firstChild().children()[2]; 7 var cancelButton = tree.root.firstChild().children()[2];
8 assertEq('Cancel', cancelButton.attributes['ax_attr_name']); 8 assertEq('Cancel', cancelButton.attributes['name']);
9 cancelButton.addEventListener('focus', function onFocusTarget(event) { 9 cancelButton.addEventListener('focus', function onFocusTarget(event) {
10 window.setTimeout(function() { 10 window.setTimeout(function() {
11 cancelButton.removeEventListener('focus', onFocusTarget); 11 cancelButton.removeEventListener('focus', onFocusTarget);
12 chrome.test.succeed(); 12 chrome.test.succeed();
13 }, 0); 13 }, 0);
14 }); 14 });
15 cancelButton.focus(); 15 cancelButton.focus();
16 }, 16 },
17 function testEventListenerBubble() { 17 function testEventListenerBubble() {
18 var cancelButton = tree.root.firstChild().children()[2]; 18 var cancelButton = tree.root.firstChild().children()[2];
19 assertEq('Cancel', cancelButton.attributes['ax_attr_name']); 19 assertEq('Cancel', cancelButton.attributes['name']);
20 var cancelButtonGotEvent = false; 20 var cancelButtonGotEvent = false;
21 cancelButton.addEventListener('focus', function onFocusBubble(event) { 21 cancelButton.addEventListener('focus', function onFocusBubble(event) {
22 cancelButtonGotEvent = true; 22 cancelButtonGotEvent = true;
23 cancelButton.removeEventListener('focus', onFocusBubble); 23 cancelButton.removeEventListener('focus', onFocusBubble);
24 }); 24 });
25 tree.root.addEventListener('focus', function onFocusBubbleRoot(event) { 25 tree.root.addEventListener('focus', function onFocusBubbleRoot(event) {
26 assertEq('focus', event.type); 26 assertEq('focus', event.type);
27 assertEq(cancelButton, event.target); 27 assertEq(cancelButton, event.target);
28 assertTrue(cancelButtonGotEvent); 28 assertTrue(cancelButtonGotEvent);
29 tree.root.removeEventListener('focus', onFocusBubbleRoot); 29 tree.root.removeEventListener('focus', onFocusBubbleRoot);
30 chrome.test.succeed(); 30 chrome.test.succeed();
31 }); 31 });
32 cancelButton.focus(); 32 cancelButton.focus();
33 }, 33 },
34 function testStopPropagation() { 34 function testStopPropagation() {
35 var cancelButton = tree.root.firstChild().children()[2]; 35 var cancelButton = tree.root.firstChild().children()[2];
36 assertEq('Cancel', cancelButton.attributes['ax_attr_name']); 36 assertEq('Cancel', cancelButton.attributes['name']);
37 function onFocusStopPropRoot(event) { 37 function onFocusStopPropRoot(event) {
38 tree.root.removeEventListener('focus', onFocusStopPropRoot); 38 tree.root.removeEventListener('focus', onFocusStopPropRoot);
39 chrome.test.fail("Focus event was propagated to root"); 39 chrome.test.fail("Focus event was propagated to root");
40 }; 40 };
41 cancelButton.addEventListener('focus', function onFocusStopProp(event) { 41 cancelButton.addEventListener('focus', function onFocusStopProp(event) {
42 cancelButton.removeEventListener('focus', onFocusStopProp); 42 cancelButton.removeEventListener('focus', onFocusStopProp);
43 event.stopPropagation(); 43 event.stopPropagation();
44 window.setTimeout((function() { 44 window.setTimeout((function() {
45 tree.root.removeEventListener('focus', onFocusStopPropRoot); 45 tree.root.removeEventListener('focus', onFocusStopPropRoot);
46 chrome.test.succeed(); 46 chrome.test.succeed();
47 }).bind(this), 0); 47 }).bind(this), 0);
48 }); 48 });
49 tree.root.addEventListener('focus', onFocusStopPropRoot); 49 tree.root.addEventListener('focus', onFocusStopPropRoot);
50 cancelButton.focus(); 50 cancelButton.focus();
51 }, 51 },
52 function testEventListenerCapture() { 52 function testEventListenerCapture() {
53 var cancelButton = tree.root.firstChild().children()[2]; 53 var cancelButton = tree.root.firstChild().children()[2];
54 assertEq('Cancel', cancelButton.attributes['ax_attr_name']); 54 assertEq('Cancel', cancelButton.attributes['name']);
55 var cancelButtonGotEvent = false; 55 var cancelButtonGotEvent = false;
56 function onFocusCapture(event) { 56 function onFocusCapture(event) {
57 cancelButtonGotEvent = true; 57 cancelButtonGotEvent = true;
58 cancelButton.removeEventListener('focus', onFocusCapture); 58 cancelButton.removeEventListener('focus', onFocusCapture);
59 chrome.test.fail("Focus event was not captured by root"); 59 chrome.test.fail("Focus event was not captured by root");
60 }; 60 };
61 cancelButton.addEventListener('focus', onFocusCapture); 61 cancelButton.addEventListener('focus', onFocusCapture);
62 tree.root.addEventListener('focus', function onFocusCaptureRoot(event) { 62 tree.root.addEventListener('focus', function onFocusCaptureRoot(event) {
63 assertEq('focus', event.type); 63 assertEq('focus', event.type);
64 assertEq(cancelButton, event.target); 64 assertEq(cancelButton, event.target);
65 assertFalse(cancelButtonGotEvent); 65 assertFalse(cancelButtonGotEvent);
66 event.stopPropagation(); 66 event.stopPropagation();
67 tree.root.removeEventListener('focus', onFocusCaptureRoot); 67 tree.root.removeEventListener('focus', onFocusCaptureRoot);
68 tree.root.removeEventListener('focus', onFocusCapture); 68 tree.root.removeEventListener('focus', onFocusCapture);
69 window.setTimeout(chrome.test.succeed.bind(this), 0); 69 window.setTimeout(chrome.test.succeed.bind(this), 0);
70 }, true); 70 }, true);
71 cancelButton.focus(); 71 cancelButton.focus();
72 } 72 }
73 ]; 73 ];
74 74
75 setUpAndRunTests(allTests) 75 setUpAndRunTests(allTests)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698