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