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

Unified Diff: chrome/renderer/translate_helper_browsertest.cc

Issue 11052002: Get the document language directly from WebKit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reduced patch that only expects langauge from http-equiv setting. Created 8 years, 2 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
« no previous file with comments | « chrome/renderer/translate_helper.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/translate_helper_browsertest.cc
diff --git a/chrome/renderer/translate_helper_browsertest.cc b/chrome/renderer/translate_helper_browsertest.cc
index 8b9d1914728dca69305b96910445c58dd1788b74..a88855e603d45b86bee63c4affe24d23e1b7c26b 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();
« no previous file with comments | « chrome/renderer/translate_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698