OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 * @fileoverview The way these tests work is as follows: | 6 * @fileoverview The way these tests work is as follows: |
7 * C++ in net_internals_ui_browsertest.cc does any necessary setup, and then | 7 * C++ in net_internals_ui_browsertest.cc does any necessary setup, and then |
8 * calls the entry point for a test with RunJavascriptTest. The called | 8 * calls the entry point for a test with RunJavascriptTest. The called |
9 * function can then use the assert/expect functions defined in test_api.js. | 9 * function can then use the assert/expect functions defined in test_api.js. |
10 * All callbacks from the browser are wrapped in such a way that they can | 10 * All callbacks from the browser are wrapped in such a way that they can |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 */ | 49 */ |
50 typedefCppFixture: 'NetInternalsTest', | 50 typedefCppFixture: 'NetInternalsTest', |
51 | 51 |
52 /** @inheritDoc */ | 52 /** @inheritDoc */ |
53 browsePreload: 'chrome://net-internals/', | 53 browsePreload: 'chrome://net-internals/', |
54 | 54 |
55 /** @inheritDoc */ | 55 /** @inheritDoc */ |
56 isAsync: true, | 56 isAsync: true, |
57 | 57 |
58 setUp: function() { | 58 setUp: function() { |
59 testing.Test.prototype.setUp.call(this); | |
60 | |
61 // Enforce accessibility auditing, but suppress some false positives. | 59 // Enforce accessibility auditing, but suppress some false positives. |
62 this.accessibilityIssuesAreErrors = true; | 60 this.accessibilityIssuesAreErrors = true; |
63 // False positive because a unicode character is used to draw a square. | 61 // False positive because a unicode character is used to draw a square. |
64 // If it was actual text it'd be too low-contrast, but a square is fine. | 62 // If it was actual text it'd be too low-contrast, but a square is fine. |
65 this.accessibilityAuditConfig.ignoreSelectors( | 63 this.accessibilityAuditConfig.ignoreSelectors( |
66 'lowContrastElements', '#timeline-view-selection-ul label'); | 64 'lowContrastElements', '#timeline-view-selection-ul label'); |
67 // Suppress this error; the black-on-gray button is readable. | 65 // Suppress this error; the black-on-gray button is readable. |
68 this.accessibilityAuditConfig.ignoreSelectors( | 66 this.accessibilityAuditConfig.ignoreSelectors( |
69 'lowContrastElements', '#export-view-save-log-file'); | 67 'lowContrastElements', '#export-view-save-log-file'); |
70 // False positive because the background color highlights and then | 68 // False positive because the background color highlights and then |
71 // fades out with a transition when there's an error. | 69 // fades out with a transition when there's an error. |
72 this.accessibilityAuditConfig.ignoreSelectors( | 70 this.accessibilityAuditConfig.ignoreSelectors( |
73 'lowContrastElements', '#hsts-view-query-output span'); | 71 'lowContrastElements', '#hsts-view-query-output span'); |
74 // False positives for unknown reason. | 72 // False positives for unknown reason. |
75 this.accessibilityAuditConfig.ignoreSelectors( | 73 this.accessibilityAuditConfig.ignoreSelectors( |
76 'focusableElementNotVisibleAndNotAriaHidden', | 74 'focusableElementNotVisibleAndNotAriaHidden', |
77 '#hsts-view-tab-content *'); | 75 '#hsts-view-tab-content *'); |
78 | 76 |
79 // TODO(aboxhall): enable when this bug is fixed: | 77 // TODO(aboxhall): enable when this bug is fixed: |
80 // https://github.com/GoogleChrome/accessibility-developer-tools/issues/69 | 78 // https://github.com/GoogleChrome/accessibility-developer-tools/issues/69 |
81 this.accessibilityAuditConfig.auditRulesToIgnore.push( | 79 this.accessibilityAuditConfig.auditRulesToIgnore.push( |
82 'focusableElementNotVisibleAndNotAriaHidden'); | 80 'focusableElementNotVisibleAndNotAriaHidden'); |
83 | 81 |
84 var controlsWithoutLabelSelectors = [ | |
85 '#export-view-user-comments', | |
86 '#hsts-view-add-input', | |
87 '#hsts-view-delete-input', | |
88 '#hsts-view-query-input', | |
89 ]; | |
90 | |
91 // Enable when failure is resolved. | |
92 // AX_TEXT_01: http://crbug.com/559203 | |
93 this.accessibilityAuditConfig.ignoreSelectors( | |
94 'controlsWithoutLabel', | |
95 controlsWithoutLabelSelectors); | |
96 | |
97 // Enable when warning is resolved. | |
98 // AX_HTML_01: http://crbug.com/559204 | |
99 this.accessibilityAuditConfig.ignoreSelectors( | |
100 'humanLangMissing', | |
101 'html'); | |
102 | |
103 // Wrap g_browser.receive around a test function so that assert and expect | 82 // Wrap g_browser.receive around a test function so that assert and expect |
104 // functions can be called from observers. | 83 // functions can be called from observers. |
105 g_browser.receive = | 84 g_browser.receive = |
106 this.continueTest(WhenTestDone.EXPECT, | 85 this.continueTest(WhenTestDone.EXPECT, |
107 BrowserBridge.prototype.receive.bind(g_browser)); | 86 BrowserBridge.prototype.receive.bind(g_browser)); |
108 | 87 |
109 g_browser.setPollInterval(TESTING_POLL_INTERVAL_MS); | 88 g_browser.setPollInterval(TESTING_POLL_INTERVAL_MS); |
110 | 89 |
111 var runTest = this.deferRunTest(WhenTestDone.EXPECT); | 90 var runTest = this.deferRunTest(WhenTestDone.EXPECT); |
112 | 91 |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 ]; | 724 ]; |
746 | 725 |
747 for (var i = 0; i < allIds.length; ++i) { | 726 for (var i = 0; i < allIds.length; ++i) { |
748 var curId = allIds[i]; | 727 var curId = allIds[i]; |
749 expectEquals(nodeId == curId, NetInternalsTest.nodeIsVisible($(curId))); | 728 expectEquals(nodeId == curId, NetInternalsTest.nodeIsVisible($(curId))); |
750 } | 729 } |
751 }; | 730 }; |
752 | 731 |
753 return NetInternalsTest; | 732 return NetInternalsTest; |
754 })(); | 733 })(); |
OLD | NEW |