OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // The following test runs the BiDi Checker on the current page with LTR | 5 // The following test runs the BiDi Checker on the current page with LTR |
6 // base direction. Any bad mixture or RTL and LTR will be reported back | 6 // base direction. Any bad mixture or RTL and LTR will be reported back |
7 // by this test. | 7 // by this test. |
8 | 8 |
9 function filtersForPage(pageName, isRTL) { | 9 function filtersForPage(pageName, isRTL) { |
10 // Suppression filters should be added to the object below. You may omit | 10 // Suppression filters should be added to the object below. You may omit |
11 // either RTL or LTR filters, or may not include filters for your page at all. | 11 // either RTL or LTR filters, or may not include filters for your page at all. |
12 // For additional info about BidiChecker go to | 12 // For additional info about BidiChecker go to |
13 // http://code.google.com/p/bidichecker | 13 // http://code.google.com/p/bidichecker |
14 // For specific info about filters, check out the following links: | 14 // For specific info about filters, check out the following links: |
15 // http://bidichecker.googlecode.com/svn/trunk/docs/users_guide.html#TOC-Error
-descriptions | 15 // http://bidichecker.googlecode.com/svn/trunk/docs/users_guide.html |
| 16 // #TOC-Error-descriptions |
16 // http://bidichecker.googlecode.com/svn/trunk/docs/jsdoc/index.html | 17 // http://bidichecker.googlecode.com/svn/trunk/docs/jsdoc/index.html |
17 // TODO(ofri): Link to more comprehensive documentation when available. | 18 // TODO(ofri): Link to more comprehensive documentation when available. |
18 var filters = { | 19 var filters = { |
19 // Page filters | 20 // Page filters |
20 "chrome://history" : { | 21 "chrome://history" : { |
21 // Filters for LTR UI | 22 // Filters for LTR UI |
22 "LTR" : [ | 23 "LTR" : [ |
23 // BUG: http://code.google.com/p/chromium/issues/detail?id=80791 | 24 // BUG: http://crbug.com/80791 |
24 bidichecker.FilterFactory.atText("בדיקה") | 25 bidichecker.FilterFactory.atText("בדיקה") |
25 ], | 26 ], |
26 // Filters for RTL UI | 27 // Filters for RTL UI |
27 "RTL" : [ | 28 "RTL" : [ |
28 // BUG: http://code.google.com/p/chromium/issues/detail?id=80791 | 29 // BUG: http://crbug.com/80791 |
29 bidichecker.FilterFactory.atText("Google"), | 30 bidichecker.FilterFactory.atText("Google"), |
30 bidichecker.FilterFactory.atText("www.google.com"), | 31 bidichecker.FilterFactory.atText("www.google.com"), |
31 // The following two are probably false positives since we can't | 32 // The following two are probably false positives since we can't |
32 // completely change the environment to RTL on Linux. | 33 // completely change the environment to RTL on Linux. |
33 // TODO(ofri): Verify that it's indeed a false positive. | 34 // TODO(ofri): Verify that it's indeed a false positive. |
34 bidichecker.FilterFactory.locationClass('day'), | 35 bidichecker.FilterFactory.locationClass('day'), |
35 bidichecker.FilterFactory.locationClass('time') | 36 bidichecker.FilterFactory.locationClass('time') |
36 ] | 37 ] |
37 }, | 38 }, |
38 "chrome://settings/autofill" : { | 39 "chrome://settings/autofill" : { |
39 "LTR" : [ | 40 "LTR" : [ |
40 // BUG: http://code.google.com/p/chromium/issues/detail?id=82267 | 41 // BUG: http://crbug.com/82267 |
41 bidichecker.FilterFactory.atText("משה ב כהן, דרך מנחם בגין") | 42 bidichecker.FilterFactory.atText("משה ב כהן, דרך מנחם בגין") |
42 ], | 43 ], |
43 "RTL" : [ | 44 "RTL" : [ |
44 // BUG: http://code.google.com/p/chromium/issues/detail?id=90322 | 45 // BUG: http://crbug.com/90322 |
45 bidichecker.FilterFactory.atText( | 46 bidichecker.FilterFactory.atText( |
46 "Milton C. Waddams, 4120 Freidrich Lane") | 47 "Milton C. Waddams, 4120 Freidrich Lane") |
47 ] | 48 ] |
48 }, | 49 }, |
49 "chrome://plugins" : { | 50 "chrome://plugins" : { |
50 "RTL" : [ | 51 "RTL" : [ |
51 // False positive | 52 // False positive |
52 bidichecker.FilterFactory.atText('x'), | 53 bidichecker.FilterFactory.atText('x'), |
53 // Apparently also a false positive | 54 // Apparently also a false positive |
54 bidichecker.FilterFactory.atText("undefined\n undefined"), | 55 bidichecker.FilterFactory.atText("undefined\n undefined"), |
55 bidichecker.FilterFactory.locationClass('plugin-text') | 56 bidichecker.FilterFactory.locationClass('plugin-text') |
56 ] | 57 ] |
57 }, | 58 }, |
58 "chrome://newtab" : { | 59 "chrome://newtab" : { |
59 "RTL" : [ | 60 "RTL" : [ |
60 // BUG: http://code.google.com/p/chromium/issues/detail?id=93339 | 61 // BUG: http://crbug.com/93339 |
61 bidichecker.FilterFactory.atText("Chrome Web Store"), | 62 bidichecker.FilterFactory.atText("Chrome Web Store"), |
62 bidichecker.FilterFactory.atText("File Manager") | 63 bidichecker.FilterFactory.atText("File Manager") |
63 ] | 64 ] |
| 65 }, |
| 66 "chrome://bugreport#0?description=%D7%91%D7%93%D7%99%D7%A7%D7%94&issueType=1" : |
| 67 { |
| 68 "LTR" : [ |
| 69 // BUG: http://crbug.com/90835 |
| 70 bidichecker.FilterFactory.atText("בדיקה") |
| 71 ] |
| 72 }, |
| 73 "chrome://bugreport#0?description=test&issueType=1" : { |
| 74 "RTL" : [ |
| 75 // BUG: http://crbug.com/90835 |
| 76 bidichecker.FilterFactory.atText("test"), |
| 77 bidichecker.FilterFactory.atText("stub-user@example.com") |
| 78 ] |
| 79 }, |
| 80 "chrome://settings/browser" : { |
| 81 "LTR" : [ |
| 82 // BUG: http://crbug.com/93702 |
| 83 bidichecker.FilterFactory.atText( |
| 84 "חדשות תוכן ועדכונים - ידיעות אחרונות") |
| 85 ] |
| 86 }, |
| 87 "chrome://settings/clearBrowserData" : { |
| 88 "RTL" : [ |
| 89 // BUG: http://crbug.com/94070 |
| 90 bidichecker.FilterFactory.atText("Google Cloud Print") |
| 91 ] |
| 92 }, |
| 93 "chrome://settings/content" : { |
| 94 "RTL" : [ |
| 95 // BUG: http://crbug.com/94070 |
| 96 bidichecker.FilterFactory.atText("Google Cloud Print") |
| 97 ] |
| 98 }, |
| 99 "chrome://settings/languages" : { |
| 100 "RTL" : [ |
| 101 // BUG: http://crbug.com/94070 |
| 102 bidichecker.FilterFactory.atText("Google Cloud Print"), |
| 103 bidichecker.FilterFactory.atText("Hebrew"), |
| 104 bidichecker.FilterFactory.atText("English (United States"), |
| 105 bidichecker.FilterFactory.atText("English"), |
| 106 // Items in timezone dropdown: |
| 107 bidichecker.FilterFactory.precededByText("(") |
| 108 ] |
| 109 }, |
| 110 "chrome://settings/contentExceptions" : { |
| 111 "RTL" : [ |
| 112 // BUG: http://crbug.com/94070 |
| 113 bidichecker.FilterFactory.atText("Google Cloud Print") |
| 114 ] |
64 } | 115 } |
65 }; | 116 }; |
66 | 117 |
67 var dir = isRTL ? "RTL" : "LTR"; | 118 var dir = isRTL ? "RTL" : "LTR"; |
68 if (!filters.hasOwnProperty(pageName)) | 119 if (!filters.hasOwnProperty(pageName)) |
69 pageName += '/'; | 120 pageName += '/'; |
70 if (!filters.hasOwnProperty(pageName)) { | 121 if (!filters.hasOwnProperty(pageName)) { |
71 if (pageName.charAt(pageName.length - 2) == '/') | 122 if (pageName.charAt(pageName.length - 2) == '/') |
72 pageName = pageName.substr(0, pageName.length - 2); | 123 pageName = pageName.substr(0, pageName.length - 2); |
73 else | 124 else |
(...skipping 16 matching lines...) Expand all Loading... |
90 } | 141 } |
91 prettyErrors += '\n\n'; | 142 prettyErrors += '\n\n'; |
92 return prettyErrors; | 143 return prettyErrors; |
93 } | 144 } |
94 | 145 |
95 function runBidiChecker(pageName, isRTL) { | 146 function runBidiChecker(pageName, isRTL) { |
96 var filters = filtersForPage(pageName, isRTL); | 147 var filters = filtersForPage(pageName, isRTL); |
97 var bidiErrors = bidichecker.checkPage(isRTL, top.document.body, filters); | 148 var bidiErrors = bidichecker.checkPage(isRTL, top.document.body, filters); |
98 assertTrue(bidiErrors.length == 0, buildPrettyErrors(bidiErrors)); | 149 assertTrue(bidiErrors.length == 0, buildPrettyErrors(bidiErrors)); |
99 } | 150 } |
OLD | NEW |