| 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://code.google.com/p/chromium/issues/detail?id=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://code.google.com/p/chromium/issues/detail?id=80791 |
| 29 bidichecker.FilterFactory.atText("Google"), | 29 bidichecker.FilterFactory.atText("Google"), |
| 30 bidichecker.FilterFactory.atText("www.google.com"), |
| 30 // The following two are probably false positives since we can't | 31 // The following two are probably false positives since we can't |
| 31 // completely change the environment to RTL on Linux. | 32 // completely change the environment to RTL on Linux. |
| 32 // TODO(ofri): Verify that it's indeed a false positive. | 33 // TODO(ofri): Verify that it's indeed a false positive. |
| 33 bidichecker.FilterFactory.locationClass('day'), | 34 bidichecker.FilterFactory.locationClass('day'), |
| 34 bidichecker.FilterFactory.locationClass('time') | 35 bidichecker.FilterFactory.locationClass('time') |
| 35 ] | 36 ] |
| 36 }, | 37 }, |
| 37 "chrome://settings/autofill" : { | 38 "chrome://settings/autofill" : { |
| 38 "LTR" : [ | 39 "LTR" : [ |
| 39 // BUG: http://code.google.com/p/chromium/issues/detail?id=82267 | 40 // BUG: http://code.google.com/p/chromium/issues/detail?id=82267 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 90 } |
| 90 prettyErrors += '\n\n'; | 91 prettyErrors += '\n\n'; |
| 91 return prettyErrors; | 92 return prettyErrors; |
| 92 } | 93 } |
| 93 | 94 |
| 94 function runBidiChecker(pageName, isRTL) { | 95 function runBidiChecker(pageName, isRTL) { |
| 95 var filters = filtersForPage(pageName, isRTL); | 96 var filters = filtersForPage(pageName, isRTL); |
| 96 var bidiErrors = bidichecker.checkPage(isRTL, top.document.body, filters); | 97 var bidiErrors = bidichecker.checkPage(isRTL, top.document.body, filters); |
| 97 assertTrue(bidiErrors.length == 0, buildPrettyErrors(bidiErrors)); | 98 assertTrue(bidiErrors.length == 0, buildPrettyErrors(bidiErrors)); |
| 98 } | 99 } |
| OLD | NEW |