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

Side by Side Diff: content/renderer/render_view_browsertest.cc

Issue 6874038: Remove the last Chrome dependencies from renderer, and enforce no more includes through DEPS. I ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/basictypes.h" 5 #include "base/basictypes.h"
6 6
7 #include "base/file_util.h"
8 #include "base/shared_memory.h" 7 #include "base/shared_memory.h"
9 #include "base/string_util.h" 8 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
11 #include "chrome/common/autofill_messages.h"
12 #include "chrome/common/content_settings.h"
13 #include "chrome/common/render_messages.h" 10 #include "chrome/common/render_messages.h"
14 #include "chrome/renderer/print_web_view_helper.h"
15 #include "chrome/test/render_view_test.h" 11 #include "chrome/test/render_view_test.h"
16 #include "content/common/native_web_keyboard_event.h" 12 #include "content/common/native_web_keyboard_event.h"
17 #include "content/common/view_messages.h" 13 #include "content/common/view_messages.h"
18 #include "net/base/net_errors.h" 14 #include "net/base/net_errors.h"
19 #include "printing/image.h"
20 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h"
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h"
25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
26 #include "ui/base/keycodes/keyboard_codes.h" 19 #include "ui/base/keycodes/keyboard_codes.h"
27 #include "ui/gfx/codec/jpeg_codec.h" 20 #include "ui/gfx/codec/jpeg_codec.h"
28 #include "webkit/glue/form_data.h"
29 #include "webkit/glue/form_field.h"
30 #include "webkit/glue/web_io_operators.h" 21 #include "webkit/glue/web_io_operators.h"
31 22
32 using WebKit::WebDocument;
33 using WebKit::WebFrame; 23 using WebKit::WebFrame;
34 using WebKit::WebInputElement;
35 using WebKit::WebString; 24 using WebKit::WebString;
36 using WebKit::WebTextDirection; 25 using WebKit::WebTextDirection;
37 using WebKit::WebURLError; 26 using WebKit::WebURLError;
38 using webkit_glue::FormData;
39 using webkit_glue::FormField;
40
41 namespace {
42
43 const char kPrintWithJSHTML[] =
44 "<body>Hello<script>window.print()</script>World</body>";
45
46 } // namespace
47 27
48 // Test that we get form state change notifications when input fields change. 28 // Test that we get form state change notifications when input fields change.
49 TEST_F(RenderViewTest, OnNavStateChanged) { 29 TEST_F(RenderViewTest, OnNavStateChanged) {
50 // Don't want any delay for form state sync changes. This will still post a 30 // Don't want any delay for form state sync changes. This will still post a
51 // message so updates will get coalesced, but as soon as we spin the message 31 // message so updates will get coalesced, but as soon as we spin the message
52 // loop, it will generate an update. 32 // loop, it will generate an update.
53 view_->set_send_content_state_immediately(true); 33 view_->set_send_content_state_immediately(true);
54 34
55 LoadHTML("<input type=\"text\" id=\"elt_text\"></input>"); 35 LoadHTML("<input type=\"text\" id=\"elt_text\"></input>");
56 36
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 367
388 // Copy the document content to std::wstring and compare with the 368 // Copy the document content to std::wstring and compare with the
389 // expected result. 369 // expected result.
390 const int kMaxOutputCharacters = 16; 370 const int kMaxOutputCharacters = 16;
391 std::wstring output = UTF16ToWideHack( 371 std::wstring output = UTF16ToWideHack(
392 GetMainFrame()->contentAsText(kMaxOutputCharacters)); 372 GetMainFrame()->contentAsText(kMaxOutputCharacters));
393 EXPECT_EQ(output, kTextDirection[i].expected_result); 373 EXPECT_EQ(output, kTextDirection[i].expected_result);
394 } 374 }
395 } 375 }
396 376
397 // Tests that printing pages work and sending and receiving messages through
398 // that channel all works.
399 TEST_F(RenderViewTest, OnPrintPages) {
400 // Lets simulate a print pages with Hello world.
401 LoadHTML("<body><p>Hello World!</p></body>");
402 PrintWebViewHelper::Get(view_)->OnPrintPages();
403
404 VerifyPageCount(1);
405 VerifyPagesPrinted(true);
406 }
407
408 // Duplicate of OnPrintPagesTest only using javascript to print.
409 TEST_F(RenderViewTest, PrintWithJavascript) {
410 // HTML contains a call to window.print()
411 LoadHTML(kPrintWithJSHTML);
412
413 VerifyPageCount(1);
414 VerifyPagesPrinted(true);
415 }
416
417 // Tests that the renderer blocks window.print() calls if they occur too
418 // frequently.
419 TEST_F(RenderViewTest, BlockScriptInitiatedPrinting) {
420 // Pretend user will cancel printing.
421 render_thread_.set_print_dialog_user_response(false);
422 // Try to print with window.print() a few times.
423 LoadHTML(kPrintWithJSHTML);
424 LoadHTML(kPrintWithJSHTML);
425 LoadHTML(kPrintWithJSHTML);
426 VerifyPagesPrinted(false);
427
428 // Pretend user will print. (but printing is blocked.)
429 render_thread_.set_print_dialog_user_response(true);
430 LoadHTML(kPrintWithJSHTML);
431 VerifyPagesPrinted(false);
432
433 // Unblock script initiated printing and verify printing works.
434 PrintWebViewHelper::Get(view_)->ResetScriptedPrintCount();
435 render_thread_.printer()->ResetPrinter();
436 LoadHTML(kPrintWithJSHTML);
437 VerifyPageCount(1);
438 VerifyPagesPrinted(true);
439 }
440
441 #if defined(OS_WIN) || defined(OS_MACOSX)
442 // TODO(estade): I don't think this test is worth porting to Linux. We will have
443 // to rip out and replace most of the IPC code if we ever plan to improve
444 // printing, and the comment below by sverrir suggests that it doesn't do much
445 // for us anyway.
446 TEST_F(RenderViewTest, PrintWithIframe) {
447 // Document that populates an iframe.
448 const char html[] =
449 "<html><body>Lorem Ipsum:"
450 "<iframe name=\"sub1\" id=\"sub1\"></iframe><script>"
451 " document.write(frames['sub1'].name);"
452 " frames['sub1'].document.write("
453 " '<p>Cras tempus ante eu felis semper luctus!</p>');"
454 "</script></body></html>";
455
456 LoadHTML(html);
457
458 // Find the frame and set it as the focused one. This should mean that that
459 // the printout should only contain the contents of that frame.
460 WebFrame* sub1_frame =
461 view_->webview()->findFrameByName(WebString::fromUTF8("sub1"));
462 ASSERT_TRUE(sub1_frame);
463 view_->webview()->setFocusedFrame(sub1_frame);
464 ASSERT_NE(view_->webview()->focusedFrame(),
465 view_->webview()->mainFrame());
466
467 // Initiate printing.
468 PrintWebViewHelper::Get(view_)->OnPrintPages();
469
470 // Verify output through MockPrinter.
471 const MockPrinter* printer(render_thread_.printer());
472 ASSERT_EQ(1, printer->GetPrintedPages());
473 const printing::Image& image1(printer->GetPrintedPage(0)->image());
474
475 // TODO(sverrir): Figure out a way to improve this test to actually print
476 // only the content of the iframe. Currently image1 will contain the full
477 // page.
478 EXPECT_NE(0, image1.size().width());
479 EXPECT_NE(0, image1.size().height());
480 }
481 #endif
482
483 // Tests if we can print a page and verify its results.
484 // This test prints HTML pages into a pseudo printer and check their outputs,
485 // i.e. a simplified version of the PrintingLayoutTextTest UI test.
486 namespace {
487 // Test cases used in this test.
488 struct TestPageData {
489 const char* page;
490 size_t printed_pages;
491 int width;
492 int height;
493 const char* checksum;
494 const wchar_t* file;
495 };
496
497 const TestPageData kTestPages[] = {
498 {"<html>"
499 "<head>"
500 "<meta"
501 " http-equiv=\"Content-Type\""
502 " content=\"text/html; charset=utf-8\"/>"
503 "<title>Test 1</title>"
504 "</head>"
505 "<body style=\"background-color: white;\">"
506 "<p style=\"font-family: arial;\">Hello World!</p>"
507 "</body>",
508 #if defined(OS_MACOSX)
509 // Mac printing code compensates for the WebKit scale factor while generating
510 // the metafile, so we expect smaller pages.
511 1, 540, 720,
512 #else
513 1, 675, 900,
514 #endif
515 NULL,
516 NULL,
517 },
518 };
519 } // namespace
520
521 // TODO(estade): need to port MockPrinter to get this on Linux. This involves
522 // hooking up Cairo to read a pdf stream, or accessing the cairo surface in the
523 // metafile directly.
524 #if defined(OS_WIN) || defined(OS_MACOSX)
525 TEST_F(RenderViewTest, PrintLayoutTest) {
526 bool baseline = false;
527
528 EXPECT_TRUE(render_thread_.printer() != NULL);
529 for (size_t i = 0; i < arraysize(kTestPages); ++i) {
530 // Load an HTML page and print it.
531 LoadHTML(kTestPages[i].page);
532 PrintWebViewHelper::Get(view_)->OnPrintPages();
533
534 // MockRenderThread::Send() just calls MockRenderThread::OnMsgReceived().
535 // So, all IPC messages sent in the above RenderView::OnPrintPages() call
536 // has been handled by the MockPrinter object, i.e. this printing job
537 // has been already finished.
538 // So, we can start checking the output pages of this printing job.
539 // Retrieve the number of pages actually printed.
540 size_t pages = render_thread_.printer()->GetPrintedPages();
541 EXPECT_EQ(kTestPages[i].printed_pages, pages);
542
543 // Retrieve the width and height of the output page.
544 int width = render_thread_.printer()->GetWidth(0);
545 int height = render_thread_.printer()->GetHeight(0);
546
547 // Check with margin for error. This has been failing with a one pixel
548 // offset on our buildbot.
549 const int kErrorMargin = 5; // 5%
550 EXPECT_GT(kTestPages[i].width * (100 + kErrorMargin) / 100, width);
551 EXPECT_LT(kTestPages[i].width * (100 - kErrorMargin) / 100, width);
552 EXPECT_GT(kTestPages[i].height * (100 + kErrorMargin) / 100, height);
553 EXPECT_LT(kTestPages[i].height* (100 - kErrorMargin) / 100, height);
554
555 // Retrieve the checksum of the bitmap data from the pseudo printer and
556 // compare it with the expected result.
557 std::string bitmap_actual;
558 EXPECT_TRUE(render_thread_.printer()->GetBitmapChecksum(0, &bitmap_actual));
559 if (kTestPages[i].checksum)
560 EXPECT_EQ(kTestPages[i].checksum, bitmap_actual);
561
562 if (baseline) {
563 // Save the source data and the bitmap data into temporary files to
564 // create base-line results.
565 FilePath source_path;
566 file_util::CreateTemporaryFile(&source_path);
567 render_thread_.printer()->SaveSource(0, source_path);
568
569 FilePath bitmap_path;
570 file_util::CreateTemporaryFile(&bitmap_path);
571 render_thread_.printer()->SaveBitmap(0, bitmap_path);
572 }
573 }
574 }
575 #endif
576
577 // Test that we can receive correct DOM events when we send input events 377 // Test that we can receive correct DOM events when we send input events
578 // through the RenderWidget::OnHandleInputEvent() function. 378 // through the RenderWidget::OnHandleInputEvent() function.
579 TEST_F(RenderViewTest, OnHandleKeyboardEvent) { 379 TEST_F(RenderViewTest, OnHandleKeyboardEvent) {
580 #if defined(OS_WIN) || defined(OS_LINUX) 380 #if defined(OS_WIN) || defined(OS_LINUX)
581 // Load an HTML page consisting of one <input> element and three 381 // Load an HTML page consisting of one <input> element and three
582 // contentediable <div> elements. 382 // contentediable <div> elements.
583 // The <input> element is used for sending keyboard events, and the <div> 383 // The <input> element is used for sending keyboard events, and the <div>
584 // elements are used for writing DOM events in the following format: 384 // elements are used for writing DOM events in the following format:
585 // "<keyCode>,<shiftKey>,<controlKey>,<altKey>". 385 // "<keyCode>,<shiftKey>,<controlKey>,<altKey>".
586 // TODO(hbono): <http://crbug.com/2215> Our WebKit port set |ev.metaKey| to 386 // TODO(hbono): <http://crbug.com/2215> Our WebKit port set |ev.metaKey| to
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 EXPECT_NE(-1, block_index); 820 EXPECT_NE(-1, block_index);
1021 EXPECT_LT(navigation_index, block_index); 821 EXPECT_LT(navigation_index, block_index);
1022 } 822 }
1023 823
1024 // Regression test for http://crbug.com/41562 824 // Regression test for http://crbug.com/41562
1025 TEST_F(RenderViewTest, UpdateTargetURLWithInvalidURL) { 825 TEST_F(RenderViewTest, UpdateTargetURLWithInvalidURL) {
1026 const GURL invalid_gurl("http://"); 826 const GURL invalid_gurl("http://");
1027 view_->setMouseOverURL(WebKit::WebURL(invalid_gurl)); 827 view_->setMouseOverURL(WebKit::WebURL(invalid_gurl));
1028 EXPECT_EQ(invalid_gurl, view_->target_url_); 828 EXPECT_EQ(invalid_gurl, view_->target_url_);
1029 } 829 }
1030
1031 TEST_F(RenderViewTest, SendForms) {
1032 // Don't want any delay for form state sync changes. This will still post a
1033 // message so updates will get coalesced, but as soon as we spin the message
1034 // loop, it will generate an update.
1035 view_->set_send_content_state_immediately(true);
1036
1037 LoadHTML("<form method=\"POST\">"
1038 " <input type=\"text\" id=\"firstname\"/>"
1039 " <input type=\"text\" id=\"middlename\" autoComplete=\"off\"/>"
1040 " <input type=\"hidden\" id=\"lastname\"/>"
1041 " <select id=\"state\"/>"
1042 " <option>?</option>"
1043 " <option>California</option>"
1044 " <option>Texas</option>"
1045 " </select>"
1046 "</form>");
1047
1048 // Verify that "FormsSeen" sends the expected number of fields.
1049 ProcessPendingMessages();
1050 const IPC::Message* message = render_thread_.sink().GetFirstMessageMatching(
1051 AutofillHostMsg_FormsSeen::ID);
1052 ASSERT_NE(static_cast<IPC::Message*>(NULL), message);
1053 AutofillHostMsg_FormsSeen::Param params;
1054 AutofillHostMsg_FormsSeen::Read(message, &params);
1055 const std::vector<FormData>& forms = params.a;
1056 ASSERT_EQ(1UL, forms.size());
1057 ASSERT_EQ(3UL, forms[0].fields.size());
1058 EXPECT_TRUE(forms[0].fields[0].StrictlyEqualsHack(
1059 FormField(string16(),
1060 ASCIIToUTF16("firstname"),
1061 string16(),
1062 ASCIIToUTF16("text"),
1063 WebInputElement::defaultMaxLength(),
1064 false))) << forms[0].fields[0];
1065 EXPECT_TRUE(forms[0].fields[1].StrictlyEqualsHack(
1066 FormField(string16(),
1067 ASCIIToUTF16("middlename"),
1068 string16(),
1069 ASCIIToUTF16("text"),
1070 WebInputElement::defaultMaxLength(),
1071 false))) << forms[0].fields[1];
1072 EXPECT_TRUE(forms[0].fields[2].StrictlyEqualsHack(
1073 FormField(string16(),
1074 ASCIIToUTF16("state"),
1075 ASCIIToUTF16("?"),
1076 ASCIIToUTF16("select-one"),
1077 0,
1078 false))) << forms[0].fields[2];
1079
1080 // Verify that |didAcceptAutoFillSuggestion()| sends the expected number of
1081 // fields.
1082 WebFrame* web_frame = GetMainFrame();
1083 WebDocument document = web_frame->document();
1084 WebInputElement firstname =
1085 document.getElementById("firstname").to<WebInputElement>();
1086
1087 // Accept suggestion that contains a label. Labeled items indicate Autofill
1088 // as opposed to Autocomplete. We're testing this distinction below with
1089 // the |AutofillHostMsg_FillAutofillFormData::ID| message.
1090 autofill_agent_->didAcceptAutoFillSuggestion(
1091 firstname,
1092 WebKit::WebString::fromUTF8("Johnny"),
1093 WebKit::WebString::fromUTF8("Home"),
1094 1,
1095 -1);
1096
1097 ProcessPendingMessages();
1098 const IPC::Message* message2 = render_thread_.sink().GetUniqueMessageMatching(
1099 AutofillHostMsg_FillAutofillFormData::ID);
1100 ASSERT_NE(static_cast<IPC::Message*>(NULL), message2);
1101 AutofillHostMsg_FillAutofillFormData::Param params2;
1102 AutofillHostMsg_FillAutofillFormData::Read(message2, &params2);
1103 const FormData& form2 = params2.b;
1104 ASSERT_EQ(3UL, form2.fields.size());
1105 EXPECT_TRUE(form2.fields[0].StrictlyEqualsHack(
1106 FormField(string16(),
1107 ASCIIToUTF16("firstname"),
1108 string16(),
1109 ASCIIToUTF16("text"),
1110 WebInputElement::defaultMaxLength(),
1111 false))) << form2.fields[0];
1112 EXPECT_TRUE(form2.fields[1].StrictlyEqualsHack(
1113 FormField(string16(),
1114 ASCIIToUTF16("middlename"),
1115 string16(),
1116 ASCIIToUTF16("text"),
1117 WebInputElement::defaultMaxLength(),
1118 false))) << form2.fields[1];
1119 EXPECT_TRUE(form2.fields[2].StrictlyEqualsHack(
1120 FormField(string16(),
1121 ASCIIToUTF16("state"),
1122 ASCIIToUTF16("?"),
1123 ASCIIToUTF16("select-one"),
1124 0,
1125 false))) << form2.fields[2];
1126 }
1127
1128 TEST_F(RenderViewTest, FillFormElement) {
1129 // Don't want any delay for form state sync changes. This will still post a
1130 // message so updates will get coalesced, but as soon as we spin the message
1131 // loop, it will generate an update.
1132 view_->set_send_content_state_immediately(true);
1133
1134 LoadHTML("<form method=\"POST\">"
1135 " <input type=\"text\" id=\"firstname\"/>"
1136 " <input type=\"text\" id=\"middlename\"/>"
1137 "</form>");
1138
1139 // Verify that "FormsSeen" isn't sent, as there are too few fields.
1140 ProcessPendingMessages();
1141 const IPC::Message* message = render_thread_.sink().GetFirstMessageMatching(
1142 AutofillHostMsg_FormsSeen::ID);
1143 ASSERT_EQ(static_cast<IPC::Message*>(NULL), message);
1144
1145 // Verify that |didAcceptAutoFillSuggestion()| sets the value of the expected
1146 // field.
1147 WebFrame* web_frame = GetMainFrame();
1148 WebDocument document = web_frame->document();
1149 WebInputElement firstname =
1150 document.getElementById("firstname").to<WebInputElement>();
1151 WebInputElement middlename =
1152 document.getElementById("middlename").to<WebInputElement>();
1153 middlename.setAutofilled(true);
1154
1155 // Accept a suggestion in a form that has been auto-filled. This triggers
1156 // the direct filling of the firstname element with value parameter.
1157 autofill_agent_->didAcceptAutoFillSuggestion(firstname,
1158 WebString::fromUTF8("David"),
1159 WebString(),
1160 0,
1161 0);
1162
1163 ProcessPendingMessages();
1164 const IPC::Message* message2 = render_thread_.sink().GetUniqueMessageMatching(
1165 AutofillHostMsg_FillAutofillFormData::ID);
1166
1167 // No message should be sent in this case. |firstname| is filled directly.
1168 ASSERT_EQ(static_cast<IPC::Message*>(NULL), message2);
1169 EXPECT_EQ(firstname.value(), WebKit::WebString::fromUTF8("David"));
1170 }
1171
1172 // Tests that we send the right translatable for a page and that we respect the
1173 // "no translate" meta-tag.
1174 TEST_F(RenderViewTest, TranslatablePage) {
1175 // Suppress the normal delay that occurs when the page is loaded before which
1176 // the renderer sends the page contents to the browser.
1177 view_->set_send_content_state_immediately(true);
1178
1179 LoadHTML("<html><body>A random page with random content.</body></html>");
1180 ProcessPendingMessages();
1181 const IPC::Message* message = render_thread_.sink().GetUniqueMessageMatching(
1182 ViewHostMsg_TranslateLanguageDetermined::ID);
1183 ASSERT_NE(static_cast<IPC::Message*>(NULL), message);
1184 ViewHostMsg_TranslateLanguageDetermined::Param params;
1185 ViewHostMsg_TranslateLanguageDetermined::Read(message, &params);
1186 EXPECT_TRUE(params.b); // Translatable should be true.
1187 render_thread_.sink().ClearMessages();
1188
1189 // Now the page specifies the META tag to prevent translation.
1190 LoadHTML("<html><head><meta name=\"google\" value=\"notranslate\"></head>"
1191 "<body>A random page with random content.</body></html>");
1192 ProcessPendingMessages();
1193 message = render_thread_.sink().GetUniqueMessageMatching(
1194 ViewHostMsg_TranslateLanguageDetermined::ID);
1195 ASSERT_NE(static_cast<IPC::Message*>(NULL), message);
1196 ViewHostMsg_TranslateLanguageDetermined::Read(message, &params);
1197 EXPECT_FALSE(params.b); // Translatable should be false.
1198 render_thread_.sink().ClearMessages();
1199
1200 // Try the alternate version of the META tag (content instead of value).
1201 LoadHTML("<html><head><meta name=\"google\" content=\"notranslate\"></head>"
1202 "<body>A random page with random content.</body></html>");
1203 ProcessPendingMessages();
1204 message = render_thread_.sink().GetUniqueMessageMatching(
1205 ViewHostMsg_TranslateLanguageDetermined::ID);
1206 ASSERT_NE(static_cast<IPC::Message*>(NULL), message);
1207 ViewHostMsg_TranslateLanguageDetermined::Read(message, &params);
1208 EXPECT_FALSE(params.b); // Translatable should be false.
1209 }
1210
1211 // Tests that the language meta tag takes precedence over the CLD when reporting
1212 // the page's language.
1213 TEST_F(RenderViewTest, LanguageMetaTag) {
1214 // Suppress the normal delay that occurs when the page is loaded before which
1215 // the renderer sends the page contents to the browser.
1216 view_->set_send_content_state_immediately(true);
1217
1218 LoadHTML("<html><head><meta http-equiv=\"content-language\" content=\"es\">"
1219 "</head><body>A random page with random content.</body></html>");
1220 ProcessPendingMessages();
1221 const IPC::Message* message = render_thread_.sink().GetUniqueMessageMatching(
1222 ViewHostMsg_TranslateLanguageDetermined::ID);
1223 ASSERT_NE(static_cast<IPC::Message*>(NULL), message);
1224 ViewHostMsg_TranslateLanguageDetermined::Param params;
1225 ViewHostMsg_TranslateLanguageDetermined::Read(message, &params);
1226 EXPECT_EQ("es", params.a);
1227 render_thread_.sink().ClearMessages();
1228
1229 // Makes sure we support multiple languages specified.
1230 LoadHTML("<html><head><meta http-equiv=\"content-language\" "
1231 "content=\" fr , es,en \">"
1232 "</head><body>A random page with random content.</body></html>");
1233 ProcessPendingMessages();
1234 message = render_thread_.sink().GetUniqueMessageMatching(
1235 ViewHostMsg_TranslateLanguageDetermined::ID);
1236 ASSERT_NE(static_cast<IPC::Message*>(NULL), message);
1237 ViewHostMsg_TranslateLanguageDetermined::Read(message, &params);
1238 EXPECT_EQ("fr", params.a);
1239 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698