summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/translate_helper_browsertest.cc
diff options
context:
space:
mode:
authorbcwhite@chromium.org <bcwhite@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-16 19:35:05 +0000
committerbcwhite@chromium.org <bcwhite@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-16 19:35:05 +0000
commit256897738e25c0fae0c0cf63cdbe5ad9d7b983d8 (patch)
treeed52713454a1ee5b6b56bd17df8c7adb5bd4906e /chrome/renderer/translate_helper_browsertest.cc
parentdddc4a07311bc9fcef910645c2483b04afc38cf1 (diff)
downloadchromium_src-256897738e25c0fae0c0cf63cdbe5ad9d7b983d8.zip
chromium_src-256897738e25c0fae0c0cf63cdbe5ad9d7b983d8.tar.gz
chromium_src-256897738e25c0fae0c0cf63cdbe5ad9d7b983d8.tar.bz2
Get the document language directly from WebKit rather than trying to figure
it out ourselves. Since WebKit is already case-insensitive, this fixes test-case #3. Test-Case #1 requires WebKit support for extracting the language from the HTTP headers (https://bugs.webkit.org/show_bug.cgi?id=97929). Note that this patch will fail completely until a WebKit patch to export this information is accepted (https://bugs.webkit.org/show_bug.cgi?id=98066). BUG=145689 Review URL: https://chromiumcodereview.appspot.com/11052002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162212 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/translate_helper_browsertest.cc')
-rw-r--r--chrome/renderer/translate_helper_browsertest.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/chrome/renderer/translate_helper_browsertest.cc b/chrome/renderer/translate_helper_browsertest.cc
index 8b9d191..a88855e 100644
--- a/chrome/renderer/translate_helper_browsertest.cc
+++ b/chrome/renderer/translate_helper_browsertest.cc
@@ -367,6 +367,35 @@ TEST_F(ChromeRenderViewTest, LanguageMetaTag) {
EXPECT_EQ("fr", params.a);
}
+// Tests that the language meta tag works even with non-all-lower-case.
+// http://code.google.com/p/chromium/issues/detail?id=145689
+TEST_F(ChromeRenderViewTest, LanguageMetaTagCase) {
+ // Suppress the normal delay that occurs when the page is loaded before which
+ // the renderer sends the page contents to the browser.
+ SendContentStateImmediately();
+
+ LoadHTML("<html><head><meta http-equiv=\"Content-Language\" content=\"es\">"
+ "</head><body>A random page with random content.</body></html>");
+ const IPC::Message* message = render_thread_->sink().GetUniqueMessageMatching(
+ ChromeViewHostMsg_TranslateLanguageDetermined::ID);
+ ASSERT_NE(static_cast<IPC::Message*>(NULL), message);
+ ChromeViewHostMsg_TranslateLanguageDetermined::Param params;
+ ChromeViewHostMsg_TranslateLanguageDetermined::Read(message, &params);
+ EXPECT_EQ("es", params.a);
+ render_thread_->sink().ClearMessages();
+
+ // Makes sure we support multiple languages specified.
+ LoadHTML("<html><head><meta http-equiv=\"Content-Language\" "
+ "content=\" fr , es,en \">"
+ "</head><body>A random page with random content.</body></html>");
+ message = render_thread_->sink().GetUniqueMessageMatching(
+ ChromeViewHostMsg_TranslateLanguageDetermined::ID);
+ ASSERT_NE(static_cast<IPC::Message*>(NULL), message);
+ ChromeViewHostMsg_TranslateLanguageDetermined::Read(message, &params);
+ EXPECT_EQ("fr", params.a);
+}
+
+
// Tests that a back navigation gets a translate language message.
TEST_F(ChromeRenderViewTest, BackToTranslatablePage) {
SendContentStateImmediately();