Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(698)

Unified Diff: chrome/browser/browser_uitest.cc

Issue 118441: Fixed 3 tests that failed in hebrew enabled vista... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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());
}
« no previous file with comments | « chrome/browser/automation/automation_provider.cc ('k') | chrome/test/automation/automation_messages_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698