| Index: chrome/browser/browser_uitest.cc
|
| ===================================================================
|
| --- chrome/browser/browser_uitest.cc (revision 18052)
|
| +++ chrome/browser/browser_uitest.cc (working copy)
|
| @@ -59,6 +59,29 @@
|
| EXPECT_TRUE(window->GetWindowTitle(&title));
|
| return UTF16ToWide(title);
|
| }
|
| +
|
| + // In RTL locales wrap the page title with RTL embedding characters so that it
|
| + // matches the value returned by GetWindowTitle().
|
| + std::wstring LocaleWindowCaptionFromPageTitle(
|
| + const std::wstring& expected_title) {
|
| + std::wstring page_title = WindowCaptionFromPageTitle(expected_title);
|
| +#if defined(OS_WIN)
|
| + string16 browser_locale;
|
| +
|
| + EXPECT_TRUE(automation()->GetBrowserLocale(&browser_locale));
|
| +
|
| + const std::string& locale_utf8 = UTF16ToUTF8(browser_locale);
|
| + if (l10n_util::GetTextDirectionForLocale(locale_utf8.c_str()) ==
|
| + l10n_util::RIGHT_TO_LEFT) {
|
| + l10n_util::WrapStringWithLTRFormatting(&page_title);
|
| + }
|
| +
|
| + return page_title;
|
| +#else
|
| + // Do we need to use the above code on POSIX as well?
|
| + return page_title;
|
| +#endif
|
| + }
|
| };
|
|
|
| class VisibleBrowserTest : public UITest {
|
| @@ -77,7 +100,8 @@
|
| NavigateToURL(net::FilePathToFileURL(test_file));
|
| // The browser lazily updates the title.
|
| PlatformThread::Sleep(sleep_timeout_ms());
|
| - EXPECT_EQ(WindowCaptionFromPageTitle(L"title1.html"), GetWindowTitle());
|
| +
|
| + EXPECT_EQ(LocaleWindowCaptionFromPageTitle(L"title1.html"), GetWindowTitle());
|
| EXPECT_EQ(L"title1.html", GetActiveTabTitle());
|
| }
|
|
|
| @@ -92,7 +116,7 @@
|
| PlatformThread::Sleep(sleep_timeout_ms());
|
|
|
| const std::wstring test_title(L"Title Of Awesomeness");
|
| - EXPECT_EQ(WindowCaptionFromPageTitle(test_title), GetWindowTitle());
|
| + EXPECT_EQ(LocaleWindowCaptionFromPageTitle(test_title), GetWindowTitle());
|
| EXPECT_EQ(test_title, GetActiveTabTitle());
|
| }
|
|
|
|
|