Commit 5a96988b authored by jeremy@chromium.org's avatar jeremy@chromium.org

reland r110861 reverted after fixing ChromeOS failure.

Adding more bidichecker tests and doing some minor cleanups.

BUG=NONE
TEST=NONE
TBR=nkostylev@chromium.org

Review URL: http://codereview.chromium.org/8678005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111341 0039d316-1c4b-4281-b951-d872f2087c98
parent 31fff51a
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include "chrome/browser/autofill/personal_data_manager.h" #include "chrome/browser/autofill/personal_data_manager.h"
#include "chrome/browser/autofill/personal_data_manager_factory.h" #include "chrome/browser/autofill/personal_data_manager_factory.h"
#include "chrome/browser/history/history.h" #include "chrome/browser/history/history.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/session_startup_pref.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
...@@ -57,13 +59,17 @@ void WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(const char pageURL[], ...@@ -57,13 +59,17 @@ void WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(const char pageURL[],
Value::CreateBooleanValue(isRTL))); Value::CreateBooleanValue(isRTL)));
} }
// WebUIBidiCheckerBrowserTestFakeBidi void WebUIBidiCheckerBrowserTestLTR::RunBidiCheckerOnPage(
const char pageURL[]) {
WebUIBidiCheckerBrowserTestFakeBidi::~WebUIBidiCheckerBrowserTestFakeBidi() {} WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(pageURL, false);
}
WebUIBidiCheckerBrowserTestFakeBidi::WebUIBidiCheckerBrowserTestFakeBidi() {} void WebUIBidiCheckerBrowserTestRTL::RunBidiCheckerOnPage(
const char pageURL[]) {
WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(pageURL, true);
}
void WebUIBidiCheckerBrowserTestFakeBidi::SetUpOnMainThread() { void WebUIBidiCheckerBrowserTestRTL::SetUpOnMainThread() {
WebUIBidiCheckerBrowserTest::SetUpOnMainThread(); WebUIBidiCheckerBrowserTest::SetUpOnMainThread();
FilePath pak_path; FilePath pak_path;
app_locale_ = base::i18n::GetConfiguredLocale(); app_locale_ = base::i18n::GetConfiguredLocale();
...@@ -80,7 +86,7 @@ void WebUIBidiCheckerBrowserTestFakeBidi::SetUpOnMainThread() { ...@@ -80,7 +86,7 @@ void WebUIBidiCheckerBrowserTestFakeBidi::SetUpOnMainThread() {
#endif #endif
} }
void WebUIBidiCheckerBrowserTestFakeBidi::CleanUpOnMainThread() { void WebUIBidiCheckerBrowserTestRTL::CleanUpOnMainThread() {
WebUIBidiCheckerBrowserTest::CleanUpOnMainThread(); WebUIBidiCheckerBrowserTest::CleanUpOnMainThread();
#if defined(OS_POSIX) && defined(TOOLKIT_USES_GTK) #if defined(OS_POSIX) && defined(TOOLKIT_USES_GTK)
gtk_widget_set_default_direction(GTK_TEXT_DIR_LTR); gtk_widget_set_default_direction(GTK_TEXT_DIR_LTR);
...@@ -92,143 +98,196 @@ void WebUIBidiCheckerBrowserTestFakeBidi::CleanUpOnMainThread() { ...@@ -92,143 +98,196 @@ void WebUIBidiCheckerBrowserTestFakeBidi::CleanUpOnMainThread() {
// Tests // Tests
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestMainHistoryPageLTR) { //==============================
// chrome://history
//==============================
static void SetupHistoryPageTest(Browser* browser,
const std::string page_url,
const std::string page_title) {
HistoryService* history_service = HistoryService* history_service =
browser()->profile()->GetHistoryService(Profile::IMPLICIT_ACCESS); browser->profile()->GetHistoryService(Profile::IMPLICIT_ACCESS);
GURL history_url = GURL("http://www.ynet.co.il"); const GURL history_url = GURL(page_url);
history_service->AddPage(history_url, history::SOURCE_BROWSED); history_service->AddPage(history_url, history::SOURCE_BROWSED);
string16 title; history_service->SetPageTitle(history_url, UTF8ToUTF16(page_title));
ASSERT_TRUE(UTF8ToUTF16("\xD7\x91\xD7\x93\xD7\x99\xD7\xA7\xD7\x94\x21",
12,
&title));
history_service->SetPageTitle(history_url, title);
RunBidiCheckerOnPage(chrome::kChromeUIHistoryURL, false);
} }
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR, TestHistoryPage) {
TestMainHistoryPageRTL) { // Test an Israeli news site with a Hebrew title.
HistoryService* history_service = SetupHistoryPageTest(browser(),
browser()->profile()->GetHistoryService(Profile::IMPLICIT_ACCESS); "http://www.ynet.co.il",
GURL history_url = GURL("http://www.google.com"); "\xD7\x91\xD7\x93\xD7\x99\xD7\xA7\xD7\x94\x21");
history_service->AddPage(history_url, history::SOURCE_BROWSED); RunBidiCheckerOnPage(chrome::kChromeUIHistoryURL);
string16 title = UTF8ToUTF16("Google"); }
history_service->SetPageTitle(history_url, title);
WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(chrome::kChromeUIHistoryURL, IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL, TestHistoryPage) {
true); SetupHistoryPageTest(browser(), "http://www.google.com", "Google");
RunBidiCheckerOnPage(chrome::kChromeUIHistoryURL);
}
//==============================
// chrome://about
//==============================
// This page isn't localized to an RTL language so we test it only in English.
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR, TestAboutPage) {
RunBidiCheckerOnPage(chrome::kChromeUIAboutURL);
} }
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestAboutPageLTR) { //==============================
RunBidiCheckerOnPage(chrome::kChromeUIAboutURL, false); // chrome://bugreport
//==============================
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR, TestBugReportPage) {
// The bugreport page receives its contents as GET arguments. Here we provide
// a custom, Hebrew typed, description message.
RunBidiCheckerOnPage(
"chrome://bugreport#0?description=%D7%91%D7%93%D7%99%D7%A7%D7%94"
"&issueType=1");
} }
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestBugReportPageLTR) { IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL,
RunBidiCheckerOnPage(chrome::kChromeUIBugReportURL, false); TestBugReportPage) {
RunBidiCheckerOnPage("chrome://bugreport#0?description=test&issueType=1");
} }
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestCrashesPageLTR) { //==============================
RunBidiCheckerOnPage(chrome::kChromeUICrashesURL, false); // chrome://crashes
//==============================
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR, TestCrashesPage) {
RunBidiCheckerOnPage(chrome::kChromeUICrashesURL);
} }
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL, TestCrashesPage) {
TestCrashesPageRTL) { RunBidiCheckerOnPage(chrome::kChromeUICrashesURL);
WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(chrome::kChromeUICrashesURL,
true);
} }
//==============================
// chrome://downloads
//==============================
#if defined(OS_WIN) || defined(OS_LINUX) #if defined(OS_WIN) || defined(OS_LINUX)
// http://crbug.com/104129 // http://crbug.com/104129
#define TestDownloadsPageLTR FLAKY_TestDownloadsPageLTR #define TestDownloadsPageLTR FLAKY_TestDownloadsPage
#endif #endif
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestDownloadsPageLTR) { IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR, TestDownloadsPageLTR) {
RunBidiCheckerOnPage(chrome::kChromeUIDownloadsURL, false); RunBidiCheckerOnPage(chrome::kChromeUIDownloadsURL);
} }
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL, TestDownloadsPage) {
TestDownloadsPageRTL) { RunBidiCheckerOnPage(chrome::kChromeUIDownloadsURL);
WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(
chrome::kChromeUIDownloadsURL, true);
} }
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestNewTabPageLTR) { //==============================
RunBidiCheckerOnPage(chrome::kChromeUINewTabURL, false); // chrome://newtab
//==============================
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR, TestNewTabPage) {
RunBidiCheckerOnPage(chrome::kChromeUINewTabURL);
} }
// http://crbug.com/97453 // http://crbug.com/97453
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL,
DISABLED_TestNewTabPageRTL) { DISABLED_TestNewTabPage) {
WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(chrome::kChromeUINewTabURL, RunBidiCheckerOnPage(chrome::kChromeUINewTabURL);
true);
} }
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestPluginsPageLTR) { //==============================
RunBidiCheckerOnPage(chrome::kChromeUIPluginsURL, false); // chrome://plugins
//==============================
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR, TestPluginsPage) {
RunBidiCheckerOnPage(chrome::kChromeUIPluginsURL);
} }
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL, TestPluginsPage) {
TestPluginsPageRTL) { RunBidiCheckerOnPage(chrome::kChromeUIPluginsURL);
WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(chrome::kChromeUIPluginsURL,
true);
} }
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestSettingsPageLTR) { //==============================
RunBidiCheckerOnPage(chrome::kChromeUISettingsURL, false); // chrome://settings
//==============================
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR, TestSettingsPage) {
RunBidiCheckerOnPage(chrome::kChromeUISettingsURL);
} }
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL, TestSettingsPage) {
TestSettingsPageRTL) { RunBidiCheckerOnPage(chrome::kChromeUISettingsURL);
WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(
chrome::kChromeUISettingsURL, true);
} }
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
// http://crbug.com/94642 // http://crbug.com/94642
#define MAYBE_TestSettingsAutofillPageLTR FLAKY_TestSettingsAutofillPageLTR #define MAYBE_TestSettingsAutofillPage FLAKY_TestSettingsAutofillPage
#elif defined(OS_WIN) #elif defined(OS_WIN)
// http://crbug.com/95425 // http://crbug.com/95425
#define MAYBE_TestSettingsAutofillPageLTR FAILS_TestSettingsAutofillPageLTR #define MAYBE_TestSettingsAutofillPage FAILS_TestSettingsAutofillPage
#else #else
#define MAYBE_TestSettingsAutofillPageLTR TestSettingsAutofillPageLTR #define MAYBE_TestSettingsAutofillPage TestSettingsAutofillPage
#endif // defined(OS_MACOSX) #endif // defined(OS_MACOSX)
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest,
MAYBE_TestSettingsAutofillPageLTR) {
std::string url(chrome::kChromeUISettingsURL);
url += std::string(chrome::kAutofillSubPage);
autofill_test::DisableSystemServices(browser()->profile()); static void SetupSettingsAutofillPageTest(Profile* profile,
AutofillProfile profile; const char* first_name,
autofill_test::SetProfileInfo( const char* middle_name,
&profile, const char* last_name,
const char* email,
const char* company,
const char* address1,
const char* address2,
const char* city,
const char* state,
const char* zipcode,
const char* country,
const char* phone) {
autofill_test::DisableSystemServices(profile);
AutofillProfile autofill_profile;
autofill_test::SetProfileInfo(&autofill_profile,
first_name,
middle_name,
last_name,
email,
company,
address1,
address2,
city,
state,
zipcode,
country,
phone);
PersonalDataManager* personal_data_manager =
PersonalDataManagerFactory::GetForProfile(profile);
ASSERT_TRUE(personal_data_manager);
personal_data_manager->AddProfile(autofill_profile);
}
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR,
TestSettingsAutofillPage) {
SetupSettingsAutofillPageTest(browser()->profile(),
"\xD7\x9E\xD7\xA9\xD7\x94", "\xD7\x9E\xD7\xA9\xD7\x94",
"\xD7\x91", "\xD7\x91",
"\xD7\x9B\xD7\x94\xD7\x9F", "\xD7\x9B\xD7\x94\xD7\x9F",
"moshe.b.cohen@biditest.com", "moshe.b.cohen@biditest.com",
"\xD7\x91\xD7\x93\xD7\x99\xD7\xA7\xD7\x94\x20\xD7\x91\xD7\xA2\xD7\x9E", "\xD7\x91\xD7\x93\xD7\x99\xD7\xA7\xD7\x94\x20"
"\xD7\x93\xD7\xA8\xD7\x9A\x20\xD7\x9E\xD7\xA0\xD7\x97\xD7\x9D\x20\xD7\x91\xD7\x92\xD7\x99\xD7\x9F\x20\x32\x33", "\xD7\x91\xD7\xA2\xD7\x9E",
"\xD7\x93\xD7\xA8\xD7\x9A\x20\xD7\x9E\xD7\xA0"
"\xD7\x97\xD7\x9D\x20\xD7\x91\xD7\x92\xD7"
"\x99\xD7\x9F\x20\x32\x33",
"\xD7\xA7\xD7\x95\xD7\x9E\xD7\x94\x20\x32\x36", "\xD7\xA7\xD7\x95\xD7\x9E\xD7\x94\x20\x32\x36",
"\xD7\xAA\xD7\x9C\x20\xD7\x90\xD7\x91\xD7\x99\xD7\x91", "\xD7\xAA\xD7\x9C\x20\xD7\x90\xD7\x91\xD7\x99"
"\xD7\x91",
"", "",
"66183", "66183",
"\xD7\x99\xD7\xA9\xD7\xA8\xD7\x90\xD7\x9C", "\xD7\x99\xD7\xA9\xD7\xA8\xD7\x90\xD7\x9C",
"0000"); "0000");
PersonalDataManager* personal_data_manager =
PersonalDataManagerFactory::GetForProfile(browser()->profile());
ASSERT_TRUE(personal_data_manager);
personal_data_manager->AddProfile(profile);
RunBidiCheckerOnPage(url.c_str(), false);
}
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi,
TestSettingsAutofillPageRTL) {
std::string url(chrome::kChromeUISettingsURL); std::string url(chrome::kChromeUISettingsURL);
url += std::string(chrome::kAutofillSubPage); url += std::string(chrome::kAutofillSubPage);
RunBidiCheckerOnPage(url.c_str());
}
autofill_test::DisableSystemServices(browser()->profile()); IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL,
AutofillProfile profile; TestSettingsAutofillPage) {
autofill_test::SetProfileInfo( SetupSettingsAutofillPageTest(browser()->profile(),
&profile,
"Milton", "Milton",
"C.", "C.",
"Waddams", "Waddams",
...@@ -241,12 +300,120 @@ IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi, ...@@ -241,12 +300,120 @@ IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestFakeBidi,
"78744", "78744",
"United States", "United States",
"5125551234"); "5125551234");
std::string url(chrome::kChromeUISettingsURL);
url += std::string(chrome::kAutofillSubPage);
RunBidiCheckerOnPage(url.c_str());
}
PersonalDataManager* personal_data_manager = static void SetupSettingsBrowserOptionsTest(Profile* profile,
PersonalDataManagerFactory::GetForProfile(browser()->profile()); const GURL url,
ASSERT_TRUE(personal_data_manager); const std::string title) {
// First, add a history entry for the site. This is needed so the site's
// name will appear in the startup sites lists.
HistoryService* history_service =
profile->GetHistoryService(Profile::IMPLICIT_ACCESS);
history_service->AddPage(url, history::SOURCE_BROWSED);
history_service->SetPageTitle(url, UTF8ToUTF16(title));
// Next, add the site to the startup sites
PrefService* prefs = profile->GetPrefs();
SessionStartupPref pref = SessionStartupPref::GetStartupPref(prefs);
pref.urls.push_back(url);
SessionStartupPref::SetStartupPref(prefs, pref);
}
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR,
TestSettingsBrowserOptionsPage) {
SetupSettingsBrowserOptionsTest(browser()->profile(),
GURL("http://ynet.co.il"),
"\x79\x6E\x65\x74\x20\xD7\x97\xD7\x93\xD7"
"\xA9\xD7\x95\xD7\xAA\x20\xD7\xAA\xD7\x95"
"\xD7\x9B\xD7\x9F\x20\xD7\x95\xD7\xA2\xD7"
"\x93\xD7\x9B\xD7\x95\xD7\xA0\xD7\x99\xD7"
"\x9D\x20\x2D\x20\xD7\x99\xD7\x93\xD7\x99"
"\xD7\xA2\xD7\x95\xD7\xAA\x20\xD7\x90\xD7"
"\x97\xD7\xA8\xD7\x95\xD7\xA0\xD7\x95\xD7"
"\xAA");
std::string url(chrome::kChromeUISettingsURL);
url += std::string(chrome::kBrowserOptionsSubPage);
RunBidiCheckerOnPage(url.c_str());
}
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL,
TestSettingsBrowserOptionsPage) {
SetupSettingsBrowserOptionsTest(browser()->profile(),
GURL("http://google.com"),
"Google");
std::string url(chrome::kChromeUISettingsURL);
url += std::string(chrome::kBrowserOptionsSubPage);
RunBidiCheckerOnPage(url.c_str());
}
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR,
TestSettingsClearBrowserDataPage) {
std::string url(chrome::kChromeUISettingsURL);
url += std::string(chrome::kClearBrowserDataSubPage);
RunBidiCheckerOnPage(url.c_str());
}
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL,
TestSettingsClearBrowserDataPage) {
std::string url(chrome::kChromeUISettingsURL);
url += std::string(chrome::kClearBrowserDataSubPage);
RunBidiCheckerOnPage(url.c_str());
}
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR,
TestSettingsContentSettingsPage) {
std::string url(chrome::kChromeUISettingsURL);
url += std::string(chrome::kContentSettingsSubPage);
RunBidiCheckerOnPage(url.c_str());
}
personal_data_manager->AddProfile(profile); IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL,
TestSettingsContentSettingsPage) {
std::string url(chrome::kChromeUISettingsURL);
url += std::string(chrome::kContentSettingsSubPage);
RunBidiCheckerOnPage(url.c_str());
}
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR,
TestSettingsContentSettingsExceptionsPage) {
std::string url(chrome::kChromeUISettingsURL);
url += std::string(chrome::kContentSettingsExceptionsSubPage);
RunBidiCheckerOnPage(url.c_str());
}
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL,
TestSettingsContentSettingsExceptionsPage) {
std::string url(chrome::kChromeUISettingsURL);
url += std::string(chrome::kContentSettingsExceptionsSubPage);
RunBidiCheckerOnPage(url.c_str());
}
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR,
TestSettingsLanguageOptionsPage) {
std::string url(chrome::kChromeUISettingsURL);
url += std::string(chrome::kLanguageOptionsSubPage);
RunBidiCheckerOnPage(url.c_str());
}
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL,
TestSettingsLanguageOptionsPage) {
std::string url(chrome::kChromeUISettingsURL);
url += std::string(chrome::kLanguageOptionsSubPage);
RunBidiCheckerOnPage(url.c_str());
}
WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(url.c_str(), true); IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR,
TestSettingsSearchEnginesOptionsPage) {
std::string url(chrome::kChromeUISettingsURL);
url += std::string(chrome::kSearchEnginesSubPage);
RunBidiCheckerOnPage(url.c_str());
}
IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL,
TestSettingsSearchEnginesOptionsPage) {
std::string url(chrome::kChromeUISettingsURL);
url += std::string(chrome::kSearchEnginesSubPage);
RunBidiCheckerOnPage(url.c_str());
} }
...@@ -15,27 +15,29 @@ class WebUIBidiCheckerBrowserTest : public WebUIBrowserTest { ...@@ -15,27 +15,29 @@ class WebUIBidiCheckerBrowserTest : public WebUIBrowserTest {
public: public:
virtual ~WebUIBidiCheckerBrowserTest(); virtual ~WebUIBidiCheckerBrowserTest();
protected:
WebUIBidiCheckerBrowserTest();
// Runs the Bidi Checker on the given page URL. |isRTL| should be true when // Runs the Bidi Checker on the given page URL. |isRTL| should be true when
// the active page locale is RTL. // the active page locale is RTL.
void RunBidiCheckerOnPage(const char pageURL[], bool isRTL); void RunBidiCheckerOnPage(const char pageURL[], bool isRTL);
protected:
WebUIBidiCheckerBrowserTest();
// Setup test path. // Setup test path.
virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; virtual void SetUpInProcessBrowserTestFixture() OVERRIDE;
}; };
// Base class for BidiChecker-based tests that run with an LTR UI.
class WebUIBidiCheckerBrowserTestLTR : public WebUIBidiCheckerBrowserTest {
public:
void RunBidiCheckerOnPage(const char pageURL[]);
};
// Base class for BidiChecker-based tests that run with an RTL UI. // Base class for BidiChecker-based tests that run with an RTL UI.
// Preloads the BidiChecker JS library for each test, as well as modifies the class WebUIBidiCheckerBrowserTestRTL : public WebUIBidiCheckerBrowserTest {
// active language.
class WebUIBidiCheckerBrowserTestFakeBidi : public WebUIBidiCheckerBrowserTest {
public: public:
virtual ~WebUIBidiCheckerBrowserTestFakeBidi(); void RunBidiCheckerOnPage(const char pageURL[]);
protected: protected:
WebUIBidiCheckerBrowserTestFakeBidi();
virtual void SetUpOnMainThread() OVERRIDE; virtual void SetUpOnMainThread() OVERRIDE;
virtual void CleanUpOnMainThread() OVERRIDE; virtual void CleanUpOnMainThread() OVERRIDE;
......
...@@ -12,7 +12,8 @@ function filtersForPage(pageName, isRTL) { ...@@ -12,7 +12,8 @@ function filtersForPage(pageName, isRTL) {
// For additional info about BidiChecker go to // For additional info about BidiChecker go to
// http://code.google.com/p/bidichecker // http://code.google.com/p/bidichecker
// For specific info about filters, check out the following links: // For specific info about filters, check out the following links:
// http://bidichecker.googlecode.com/svn/trunk/docs/users_guide.html#TOC-Error-descriptions // http://bidichecker.googlecode.com/svn/trunk/docs/users_guide.html
// #TOC-Error-descriptions
// http://bidichecker.googlecode.com/svn/trunk/docs/jsdoc/index.html // http://bidichecker.googlecode.com/svn/trunk/docs/jsdoc/index.html
// TODO(ofri): Link to more comprehensive documentation when available. // TODO(ofri): Link to more comprehensive documentation when available.
var filters = { var filters = {
...@@ -20,12 +21,12 @@ function filtersForPage(pageName, isRTL) { ...@@ -20,12 +21,12 @@ function filtersForPage(pageName, isRTL) {
"chrome://history" : { "chrome://history" : {
// Filters for LTR UI // Filters for LTR UI
"LTR" : [ "LTR" : [
// BUG: http://code.google.com/p/chromium/issues/detail?id=80791 // BUG: http://crbug.com/80791
bidichecker.FilterFactory.atText("בדיקה") bidichecker.FilterFactory.atText("בדיקה")
], ],
// Filters for RTL UI // Filters for RTL UI
"RTL" : [ "RTL" : [
// BUG: http://code.google.com/p/chromium/issues/detail?id=80791 // BUG: http://crbug.com/80791
bidichecker.FilterFactory.atText("Google"), bidichecker.FilterFactory.atText("Google"),
bidichecker.FilterFactory.atText("www.google.com"), bidichecker.FilterFactory.atText("www.google.com"),
// The following two are probably false positives since we can't // The following two are probably false positives since we can't
...@@ -37,11 +38,11 @@ function filtersForPage(pageName, isRTL) { ...@@ -37,11 +38,11 @@ function filtersForPage(pageName, isRTL) {
}, },
"chrome://settings/autofill" : { "chrome://settings/autofill" : {
"LTR" : [ "LTR" : [
// BUG: http://code.google.com/p/chromium/issues/detail?id=82267 // BUG: http://crbug.com/82267
bidichecker.FilterFactory.atText("משה ב כהן, דרך מנחם בגין") bidichecker.FilterFactory.atText("משה ב כהן, דרך מנחם בגין")
], ],
"RTL" : [ "RTL" : [
// BUG: http://code.google.com/p/chromium/issues/detail?id=90322 // BUG: http://crbug.com/90322
bidichecker.FilterFactory.atText( bidichecker.FilterFactory.atText(
"Milton C. Waddams, 4120 Freidrich Lane") "Milton C. Waddams, 4120 Freidrich Lane")
] ]
...@@ -57,10 +58,60 @@ function filtersForPage(pageName, isRTL) { ...@@ -57,10 +58,60 @@ function filtersForPage(pageName, isRTL) {
}, },
"chrome://newtab" : { "chrome://newtab" : {
"RTL" : [ "RTL" : [
// BUG: http://code.google.com/p/chromium/issues/detail?id=93339 // BUG: http://crbug.com/93339
bidichecker.FilterFactory.atText("Chrome Web Store"), bidichecker.FilterFactory.atText("Chrome Web Store"),
bidichecker.FilterFactory.atText("File Manager") bidichecker.FilterFactory.atText("File Manager")
] ]
},
"chrome://bugreport#0?description=%D7%91%D7%93%D7%99%D7%A7%D7%94&issueType=1" :
{
"LTR" : [
// BUG: http://crbug.com/90835
bidichecker.FilterFactory.atText("בדיקה")
]
},
"chrome://bugreport#0?description=test&issueType=1" : {
"RTL" : [
// BUG: http://crbug.com/90835
bidichecker.FilterFactory.atText("test"),
bidichecker.FilterFactory.atText("stub-user@example.com")
]
},
"chrome://settings/browser" : {
"LTR" : [
// BUG: http://crbug.com/93702
bidichecker.FilterFactory.atText(
"חדשות תוכן ועדכונים - ידיעות אחרונות")
]
},
"chrome://settings/clearBrowserData" : {
"RTL" : [
// BUG: http://crbug.com/94070
bidichecker.FilterFactory.atText("Google Cloud Print")
]
},
"chrome://settings/content" : {
"RTL" : [
// BUG: http://crbug.com/94070
bidichecker.FilterFactory.atText("Google Cloud Print")
]
},
"chrome://settings/languages" : {
"RTL" : [
// BUG: http://crbug.com/94070
bidichecker.FilterFactory.atText("Google Cloud Print"),
bidichecker.FilterFactory.atText("Hebrew"),
bidichecker.FilterFactory.atText("English (United States"),
bidichecker.FilterFactory.atText("English"),
// Items in timezone dropdown:
bidichecker.FilterFactory.precededByText("(")
]
},
"chrome://settings/contentExceptions" : {
"RTL" : [
// BUG: http://crbug.com/94070
bidichecker.FilterFactory.atText("Google Cloud Print")
]
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment