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#TOC-Error
-descriptions |
16 // http://bidichecker.googlecode.com/svn/trunk/docs/jsdoc/index.html | 16 // http://bidichecker.googlecode.com/svn/trunk/docs/jsdoc/index.html |
17 // TODO(ofri): Link to more comprehensive documentation when available. | 17 // TODO(ofri): Link to more comprehensive documentation when available. |
18 var filters = { | 18 var filters = { |
19 // Page filters | 19 // Page filters |
20 "chrome://history" : { | 20 "chrome://history" : { |
21 // Filters for LTR UI | 21 // Filters for LTR UI |
22 "LTR" : [ | 22 "LTR" : [ |
23 // BUG: http://code.google.com/p/chromium/issues/detail?id=80791 | 23 // BUG: http://crbug.com/80791 |
24 bidichecker.FilterFactory.atText("בדיקה") | 24 bidichecker.FilterFactory.atText("בדיקה") |
25 ], | 25 ], |
26 // Filters for RTL UI | 26 // Filters for RTL UI |
27 "RTL" : [ | 27 "RTL" : [ |
28 // BUG: http://code.google.com/p/chromium/issues/detail?id=80791 | 28 // BUG: http://crbug.com/80791 |
29 bidichecker.FilterFactory.atText("Google"), | 29 bidichecker.FilterFactory.atText("Google"), |
30 bidichecker.FilterFactory.atText("www.google.com"), | 30 bidichecker.FilterFactory.atText("www.google.com"), |
31 // The following two are probably false positives since we can't | 31 // The following two are probably false positives since we can't |
32 // completely change the environment to RTL on Linux. | 32 // completely change the environment to RTL on Linux. |
33 // TODO(ofri): Verify that it's indeed a false positive. | 33 // TODO(ofri): Verify that it's indeed a false positive. |
34 bidichecker.FilterFactory.locationClass('day'), | 34 bidichecker.FilterFactory.locationClass('day'), |
35 bidichecker.FilterFactory.locationClass('time') | 35 bidichecker.FilterFactory.locationClass('time') |
36 ] | 36 ] |
37 }, | 37 }, |
38 "chrome://settings/autofill" : { | 38 "chrome://settings/autofill" : { |
39 "LTR" : [ | 39 "LTR" : [ |
40 // BUG: http://code.google.com/p/chromium/issues/detail?id=82267 | 40 // BUG: http://crbug.com/82267 |
41 bidichecker.FilterFactory.atText("משה ב כהן, דרך מנחם בגין") | 41 bidichecker.FilterFactory.atText("משה ב כהן, דרך מנחם בגין") |
42 ], | 42 ], |
43 "RTL" : [ | 43 "RTL" : [ |
44 // BUG: http://code.google.com/p/chromium/issues/detail?id=90322 | 44 // BUG: http://crbug.com/90322 |
45 bidichecker.FilterFactory.atText( | 45 bidichecker.FilterFactory.atText( |
46 "Milton C. Waddams, 4120 Freidrich Lane") | 46 "Milton C. Waddams, 4120 Freidrich Lane") |
47 ] | 47 ] |
48 }, | 48 }, |
49 "chrome://plugins" : { | 49 "chrome://plugins" : { |
50 "RTL" : [ | 50 "RTL" : [ |
51 // False positive | 51 // False positive |
52 bidichecker.FilterFactory.atText('x'), | 52 bidichecker.FilterFactory.atText('x'), |
53 // Apparently also a false positive | 53 // Apparently also a false positive |
54 bidichecker.FilterFactory.atText("undefined\n undefined"), | 54 bidichecker.FilterFactory.atText("undefined\n undefined"), |
55 bidichecker.FilterFactory.locationClass('plugin-text') | 55 bidichecker.FilterFactory.locationClass('plugin-text') |
56 ] | 56 ] |
57 }, | 57 }, |
58 "chrome://newtab" : { | 58 "chrome://newtab" : { |
59 "RTL" : [ | 59 "RTL" : [ |
60 // BUG: http://code.google.com/p/chromium/issues/detail?id=93339 | 60 // BUG: http://crbug.com/93339 |
61 bidichecker.FilterFactory.atText("Chrome Web Store"), | 61 bidichecker.FilterFactory.atText("Chrome Web Store"), |
62 bidichecker.FilterFactory.atText("File Manager") | 62 bidichecker.FilterFactory.atText("File Manager") |
63 ] | 63 ] |
| 64 }, |
| 65 "chrome://bugreport#0?description=%D7%91%D7%93%D7%99%D7%A7%D7%94&issueType=1
" : { |
| 66 "LTR" : [ |
| 67 // BUG: http://crbug.com/90835 |
| 68 bidichecker.FilterFactory.atText("בדיקה") |
| 69 ] |
| 70 }, |
| 71 "chrome://bugreport#0?description=test&issueType=1" : { |
| 72 "RTL" : [ |
| 73 // BUG: http://crbug.com/90835 |
| 74 bidichecker.FilterFactory.atText("test") |
| 75 ] |
| 76 }, |
| 77 "chrome://settings/browser" : { |
| 78 "LTR" : [ |
| 79 // BUG: http://crbug.com/93702 |
| 80 bidichecker.FilterFactory.atText("חדשות תוכן ועדכונים - ידיעות אחרונות") |
| 81 ] |
| 82 }, |
| 83 "chrome://settings/clearBrowserData" : { |
| 84 "RTL" : [ |
| 85 // BUG: http://crbug.com/94070 |
| 86 bidichecker.FilterFactory.atText("Google Cloud Print") |
| 87 ] |
| 88 }, |
| 89 "chrome://settings/content" : { |
| 90 "RTL" : [ |
| 91 // BUG: http://crbug.com/94070 |
| 92 bidichecker.FilterFactory.atText("Google Cloud Print") |
| 93 ] |
| 94 }, |
| 95 "chrome://settings/languages" : { |
| 96 "RTL" : [ |
| 97 // BUG: http://crbug.com/94070 |
| 98 bidichecker.FilterFactory.atText("Google Cloud Print"), |
| 99 bidichecker.FilterFactory.atText("Hebrew"), |
| 100 bidichecker.FilterFactory.atText("English (United States"), |
| 101 bidichecker.FilterFactory.atText("English") |
| 102 ] |
| 103 }, |
| 104 "chrome://settings/contentExceptions" : { |
| 105 "RTL" : [ |
| 106 // BUG: http://crbug.com/94070 |
| 107 bidichecker.FilterFactory.atText("Google Cloud Print") |
| 108 ] |
64 } | 109 } |
65 }; | 110 }; |
66 | 111 |
67 var dir = isRTL ? "RTL" : "LTR"; | 112 var dir = isRTL ? "RTL" : "LTR"; |
68 if (!filters.hasOwnProperty(pageName)) | 113 if (!filters.hasOwnProperty(pageName)) |
69 pageName += '/'; | 114 pageName += '/'; |
70 if (!filters.hasOwnProperty(pageName)) { | 115 if (!filters.hasOwnProperty(pageName)) { |
71 if (pageName.charAt(pageName.length - 2) == '/') | 116 if (pageName.charAt(pageName.length - 2) == '/') |
72 pageName = pageName.substr(0, pageName.length - 2); | 117 pageName = pageName.substr(0, pageName.length - 2); |
73 else | 118 else |
(...skipping 16 matching lines...) Expand all Loading... |
90 } | 135 } |
91 prettyErrors += '\n\n'; | 136 prettyErrors += '\n\n'; |
92 return prettyErrors; | 137 return prettyErrors; |
93 } | 138 } |
94 | 139 |
95 function runBidiChecker(pageName, isRTL) { | 140 function runBidiChecker(pageName, isRTL) { |
96 var filters = filtersForPage(pageName, isRTL); | 141 var filters = filtersForPage(pageName, isRTL); |
97 var bidiErrors = bidichecker.checkPage(isRTL, top.document.body, filters); | 142 var bidiErrors = bidichecker.checkPage(isRTL, top.document.body, filters); |
98 assertTrue(bidiErrors.length == 0, buildPrettyErrors(bidiErrors)); | 143 assertTrue(bidiErrors.length == 0, buildPrettyErrors(bidiErrors)); |
99 } | 144 } |
OLD | NEW |