summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_uitest.cc
diff options
context:
space:
mode:
authorhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-15 03:48:36 +0000
committerhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-15 03:48:36 +0000
commit202e7a773359b24943d7de0943dd9c7d257ab1cb (patch)
tree0f577db9ffb30c3c0a5b50f94e95ba00c137d83d /chrome/browser/browser_uitest.cc
parentf73d4744cf1ca00ca6e5dbd669d4a57be2ff6b92 (diff)
downloadchromium_src-202e7a773359b24943d7de0943dd9c7d257ab1cb.zip
chromium_src-202e7a773359b24943d7de0943dd9c7d257ab1cb.tar.gz
chromium_src-202e7a773359b24943d7de0943dd9c7d257ab1cb.tar.bz2
Fixed 3 tests that failed in hebrew enabled vista
BrowserTest.NoTitle BrowserTest.Title AutomationProxyVisibleTest.WindowGetViewBounds Some notes : There has been a small regression in the UI tests which makes them get stuck even more on my very slow machine (maybe race conditions) however, the fixes i post here do not make this state any worse and fix these 3 tests above which always failed TEST=1. run ui_tests on a RTL windows (or use --extra-chrome-flags=--lang=he) 2. the 3 tests listed above will always fail, as they expect LTR behavior 3. this fixes it BUG=12636 http://code.google.com/p/chromium/issues/detail?id=12636 Original Patch by Yoav Zilberberg <yoav.zilberberg@gmail.com> Original review: http://codereview.chromium.org/118441 R=me,jeremy,sky Review URL: http://codereview.chromium.org/125036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18370 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_uitest.cc')
-rw-r--r--chrome/browser/browser_uitest.cc27
1 files changed, 25 insertions, 2 deletions
diff --git a/chrome/browser/browser_uitest.cc b/chrome/browser/browser_uitest.cc
index adeea1f..e2533c7 100644
--- a/chrome/browser/browser_uitest.cc
+++ b/chrome/browser/browser_uitest.cc
@@ -59,6 +59,29 @@ class BrowserTest : public UITest {
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,7 @@ TEST_F(BrowserTest, NoTitle) {
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 +115,7 @@ TEST_F(BrowserTest, Title) {
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());
}