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

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

Issue 1159553007: Move Tuple to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « content/renderer/render_frame_proxy.cc ('k') | content/renderer/render_widget_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 "data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="; 399 "data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=";
400 400
401 view()->saveImageFromDataURL(WebString::fromUTF8(image_data_url)); 401 view()->saveImageFromDataURL(WebString::fromUTF8(image_data_url));
402 ProcessPendingMessages(); 402 ProcessPendingMessages();
403 const IPC::Message* msg2 = render_thread_->sink().GetFirstMessageMatching( 403 const IPC::Message* msg2 = render_thread_->sink().GetFirstMessageMatching(
404 ViewHostMsg_SaveImageFromDataURL::ID); 404 ViewHostMsg_SaveImageFromDataURL::ID);
405 EXPECT_TRUE(msg2); 405 EXPECT_TRUE(msg2);
406 406
407 ViewHostMsg_SaveImageFromDataURL::Param param1; 407 ViewHostMsg_SaveImageFromDataURL::Param param1;
408 ViewHostMsg_SaveImageFromDataURL::Read(msg2, &param1); 408 ViewHostMsg_SaveImageFromDataURL::Read(msg2, &param1);
409 EXPECT_EQ(get<1>(param1).length(), image_data_url.length()); 409 EXPECT_EQ(base::get<1>(param1).length(), image_data_url.length());
410 EXPECT_EQ(get<1>(param1), image_data_url); 410 EXPECT_EQ(base::get<1>(param1), image_data_url);
411 411
412 ProcessPendingMessages(); 412 ProcessPendingMessages();
413 render_thread_->sink().ClearMessages(); 413 render_thread_->sink().ClearMessages();
414 414
415 const std::string large_data_url(1024 * 1024 * 10 - 1, 'd'); 415 const std::string large_data_url(1024 * 1024 * 10 - 1, 'd');
416 416
417 view()->saveImageFromDataURL(WebString::fromUTF8(large_data_url)); 417 view()->saveImageFromDataURL(WebString::fromUTF8(large_data_url));
418 ProcessPendingMessages(); 418 ProcessPendingMessages();
419 const IPC::Message* msg3 = render_thread_->sink().GetFirstMessageMatching( 419 const IPC::Message* msg3 = render_thread_->sink().GetFirstMessageMatching(
420 ViewHostMsg_SaveImageFromDataURL::ID); 420 ViewHostMsg_SaveImageFromDataURL::ID);
421 EXPECT_TRUE(msg3); 421 EXPECT_TRUE(msg3);
422 422
423 ViewHostMsg_SaveImageFromDataURL::Param param2; 423 ViewHostMsg_SaveImageFromDataURL::Param param2;
424 ViewHostMsg_SaveImageFromDataURL::Read(msg3, &param2); 424 ViewHostMsg_SaveImageFromDataURL::Read(msg3, &param2);
425 EXPECT_EQ(get<1>(param2).length(), large_data_url.length()); 425 EXPECT_EQ(base::get<1>(param2).length(), large_data_url.length());
426 EXPECT_EQ(get<1>(param2), large_data_url); 426 EXPECT_EQ(base::get<1>(param2), large_data_url);
427 427
428 ProcessPendingMessages(); 428 ProcessPendingMessages();
429 render_thread_->sink().ClearMessages(); 429 render_thread_->sink().ClearMessages();
430 430
431 const std::string exceeded_data_url(1024 * 1024 * 10 + 1, 'd'); 431 const std::string exceeded_data_url(1024 * 1024 * 10 + 1, 'd');
432 432
433 view()->saveImageFromDataURL(WebString::fromUTF8(exceeded_data_url)); 433 view()->saveImageFromDataURL(WebString::fromUTF8(exceeded_data_url));
434 ProcessPendingMessages(); 434 ProcessPendingMessages();
435 const IPC::Message* msg4 = render_thread_->sink().GetFirstMessageMatching( 435 const IPC::Message* msg4 = render_thread_->sink().GetFirstMessageMatching(
436 ViewHostMsg_SaveImageFromDataURL::ID); 436 ViewHostMsg_SaveImageFromDataURL::ID);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 ProcessPendingMessages(); 481 ProcessPendingMessages();
482 482
483 const IPC::Message* frame_navigate_msg = 483 const IPC::Message* frame_navigate_msg =
484 render_thread_->sink().GetUniqueMessageMatching( 484 render_thread_->sink().GetUniqueMessageMatching(
485 FrameHostMsg_DidCommitProvisionalLoad::ID); 485 FrameHostMsg_DidCommitProvisionalLoad::ID);
486 EXPECT_TRUE(frame_navigate_msg); 486 EXPECT_TRUE(frame_navigate_msg);
487 487
488 FrameHostMsg_DidCommitProvisionalLoad::Param host_nav_params; 488 FrameHostMsg_DidCommitProvisionalLoad::Param host_nav_params;
489 FrameHostMsg_DidCommitProvisionalLoad::Read(frame_navigate_msg, 489 FrameHostMsg_DidCommitProvisionalLoad::Read(frame_navigate_msg,
490 &host_nav_params); 490 &host_nav_params);
491 EXPECT_TRUE(get<0>(host_nav_params).is_post); 491 EXPECT_TRUE(base::get<0>(host_nav_params).is_post);
492 492
493 // Check post data sent to browser matches 493 // Check post data sent to browser matches
494 EXPECT_TRUE(get<0>(host_nav_params).page_state.IsValid()); 494 EXPECT_TRUE(base::get<0>(host_nav_params).page_state.IsValid());
495 scoped_ptr<HistoryEntry> entry = 495 scoped_ptr<HistoryEntry> entry =
496 PageStateToHistoryEntry(get<0>(host_nav_params).page_state); 496 PageStateToHistoryEntry(base::get<0>(host_nav_params).page_state);
497 blink::WebHTTPBody body = entry->root().httpBody(); 497 blink::WebHTTPBody body = entry->root().httpBody();
498 blink::WebHTTPBody::Element element; 498 blink::WebHTTPBody::Element element;
499 bool successful = body.elementAt(0, element); 499 bool successful = body.elementAt(0, element);
500 EXPECT_TRUE(successful); 500 EXPECT_TRUE(successful);
501 EXPECT_EQ(blink::WebHTTPBody::Element::TypeData, element.type); 501 EXPECT_EQ(blink::WebHTTPBody::Element::TypeData, element.type);
502 EXPECT_EQ(length, element.data.size()); 502 EXPECT_EQ(length, element.data.size());
503 EXPECT_EQ(0, memcmp(raw_data, element.data.data(), length)); 503 EXPECT_EQ(0, memcmp(raw_data, element.data.data(), length));
504 } 504 }
505 505
506 TEST_F(RenderViewImplTest, DecideNavigationPolicy) { 506 TEST_F(RenderViewImplTest, DecideNavigationPolicy) {
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 // Load page B, which will trigger an UpdateState message for page A. 692 // Load page B, which will trigger an UpdateState message for page A.
693 LoadHTML("<div>Page B</div>"); 693 LoadHTML("<div>Page B</div>");
694 694
695 // Check for a valid UpdateState message for page A. 695 // Check for a valid UpdateState message for page A.
696 ProcessPendingMessages(); 696 ProcessPendingMessages();
697 const IPC::Message* msg_A = render_thread_->sink().GetUniqueMessageMatching( 697 const IPC::Message* msg_A = render_thread_->sink().GetUniqueMessageMatching(
698 ViewHostMsg_UpdateState::ID); 698 ViewHostMsg_UpdateState::ID);
699 ASSERT_TRUE(msg_A); 699 ASSERT_TRUE(msg_A);
700 ViewHostMsg_UpdateState::Param params; 700 ViewHostMsg_UpdateState::Param params;
701 ViewHostMsg_UpdateState::Read(msg_A, &params); 701 ViewHostMsg_UpdateState::Read(msg_A, &params);
702 int page_id_A = get<0>(params); 702 int page_id_A = base::get<0>(params);
703 PageState state_A = get<1>(params); 703 PageState state_A = base::get<1>(params);
704 EXPECT_EQ(1, page_id_A); 704 EXPECT_EQ(1, page_id_A);
705 render_thread_->sink().ClearMessages(); 705 render_thread_->sink().ClearMessages();
706 706
707 // Back to page A (page_id 1) and commit. 707 // Back to page A (page_id 1) and commit.
708 CommonNavigationParams common_params_A; 708 CommonNavigationParams common_params_A;
709 RequestNavigationParams request_params_A; 709 RequestNavigationParams request_params_A;
710 common_params_A.navigation_type = FrameMsg_Navigate_Type::NORMAL; 710 common_params_A.navigation_type = FrameMsg_Navigate_Type::NORMAL;
711 common_params_A.transition = ui::PAGE_TRANSITION_FORWARD_BACK; 711 common_params_A.transition = ui::PAGE_TRANSITION_FORWARD_BACK;
712 request_params_A.current_history_list_length = 2; 712 request_params_A.current_history_list_length = 2;
713 request_params_A.current_history_list_offset = 1; 713 request_params_A.current_history_list_offset = 1;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 // Verify page A committed, not swappedout://. 751 // Verify page A committed, not swappedout://.
752 const IPC::Message* frame_navigate_msg = 752 const IPC::Message* frame_navigate_msg =
753 render_thread_->sink().GetUniqueMessageMatching( 753 render_thread_->sink().GetUniqueMessageMatching(
754 FrameHostMsg_DidCommitProvisionalLoad::ID); 754 FrameHostMsg_DidCommitProvisionalLoad::ID);
755 EXPECT_TRUE(frame_navigate_msg); 755 EXPECT_TRUE(frame_navigate_msg);
756 756
757 // Read URL out of the parent trait of the params object. 757 // Read URL out of the parent trait of the params object.
758 FrameHostMsg_DidCommitProvisionalLoad::Param commit_load_params; 758 FrameHostMsg_DidCommitProvisionalLoad::Param commit_load_params;
759 FrameHostMsg_DidCommitProvisionalLoad::Read(frame_navigate_msg, 759 FrameHostMsg_DidCommitProvisionalLoad::Read(frame_navigate_msg,
760 &commit_load_params); 760 &commit_load_params);
761 EXPECT_NE(GURL("swappedout://"), get<0>(commit_load_params).url); 761 EXPECT_NE(GURL("swappedout://"), base::get<0>(commit_load_params).url);
762 } 762 }
763 763
764 // Verify that security origins are replicated properly to RenderFrameProxies 764 // Verify that security origins are replicated properly to RenderFrameProxies
765 // when swapping out. 765 // when swapping out.
766 TEST_F(RenderViewImplTest, OriginReplicationForSwapOut) { 766 TEST_F(RenderViewImplTest, OriginReplicationForSwapOut) {
767 // This test should only run with --site-per-process, since origin 767 // This test should only run with --site-per-process, since origin
768 // replication only happens in that mode. 768 // replication only happens in that mode.
769 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 769 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
770 switches::kSitePerProcess)) 770 switches::kSitePerProcess))
771 return; 771 return;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 // Load page B, which will trigger an UpdateState message for page A. 811 // Load page B, which will trigger an UpdateState message for page A.
812 LoadHTML("<div>Page B</div>"); 812 LoadHTML("<div>Page B</div>");
813 813
814 // Check for a valid UpdateState message for page A. 814 // Check for a valid UpdateState message for page A.
815 ProcessPendingMessages(); 815 ProcessPendingMessages();
816 const IPC::Message* msg_A = render_thread_->sink().GetUniqueMessageMatching( 816 const IPC::Message* msg_A = render_thread_->sink().GetUniqueMessageMatching(
817 ViewHostMsg_UpdateState::ID); 817 ViewHostMsg_UpdateState::ID);
818 ASSERT_TRUE(msg_A); 818 ASSERT_TRUE(msg_A);
819 ViewHostMsg_UpdateState::Param param; 819 ViewHostMsg_UpdateState::Param param;
820 ViewHostMsg_UpdateState::Read(msg_A, &param); 820 ViewHostMsg_UpdateState::Read(msg_A, &param);
821 int page_id_A = get<0>(param); 821 int page_id_A = base::get<0>(param);
822 PageState state_A = get<1>(param); 822 PageState state_A = base::get<1>(param);
823 EXPECT_EQ(1, page_id_A); 823 EXPECT_EQ(1, page_id_A);
824 render_thread_->sink().ClearMessages(); 824 render_thread_->sink().ClearMessages();
825 825
826 // Load page C, which will trigger an UpdateState message for page B. 826 // Load page C, which will trigger an UpdateState message for page B.
827 LoadHTML("<div>Page C</div>"); 827 LoadHTML("<div>Page C</div>");
828 828
829 // Check for a valid UpdateState for page B. 829 // Check for a valid UpdateState for page B.
830 ProcessPendingMessages(); 830 ProcessPendingMessages();
831 const IPC::Message* msg_B = render_thread_->sink().GetUniqueMessageMatching( 831 const IPC::Message* msg_B = render_thread_->sink().GetUniqueMessageMatching(
832 ViewHostMsg_UpdateState::ID); 832 ViewHostMsg_UpdateState::ID);
833 ASSERT_TRUE(msg_B); 833 ASSERT_TRUE(msg_B);
834 ViewHostMsg_UpdateState::Read(msg_B, &param); 834 ViewHostMsg_UpdateState::Read(msg_B, &param);
835 int page_id_B = get<0>(param); 835 int page_id_B = base::get<0>(param);
836 PageState state_B = get<1>(param); 836 PageState state_B = base::get<1>(param);
837 EXPECT_EQ(2, page_id_B); 837 EXPECT_EQ(2, page_id_B);
838 EXPECT_NE(state_A, state_B); 838 EXPECT_NE(state_A, state_B);
839 render_thread_->sink().ClearMessages(); 839 render_thread_->sink().ClearMessages();
840 840
841 // Load page D, which will trigger an UpdateState message for page C. 841 // Load page D, which will trigger an UpdateState message for page C.
842 LoadHTML("<div>Page D</div>"); 842 LoadHTML("<div>Page D</div>");
843 843
844 // Check for a valid UpdateState for page C. 844 // Check for a valid UpdateState for page C.
845 ProcessPendingMessages(); 845 ProcessPendingMessages();
846 const IPC::Message* msg_C = render_thread_->sink().GetUniqueMessageMatching( 846 const IPC::Message* msg_C = render_thread_->sink().GetUniqueMessageMatching(
847 ViewHostMsg_UpdateState::ID); 847 ViewHostMsg_UpdateState::ID);
848 ASSERT_TRUE(msg_C); 848 ASSERT_TRUE(msg_C);
849 ViewHostMsg_UpdateState::Read(msg_C, &param); 849 ViewHostMsg_UpdateState::Read(msg_C, &param);
850 int page_id_C = get<0>(param); 850 int page_id_C = base::get<0>(param);
851 PageState state_C = get<1>(param); 851 PageState state_C = base::get<1>(param);
852 EXPECT_EQ(3, page_id_C); 852 EXPECT_EQ(3, page_id_C);
853 EXPECT_NE(state_B, state_C); 853 EXPECT_NE(state_B, state_C);
854 render_thread_->sink().ClearMessages(); 854 render_thread_->sink().ClearMessages();
855 855
856 // Go back to C and commit, preparing for our real test. 856 // Go back to C and commit, preparing for our real test.
857 CommonNavigationParams common_params_C; 857 CommonNavigationParams common_params_C;
858 RequestNavigationParams request_params_C; 858 RequestNavigationParams request_params_C;
859 common_params_C.navigation_type = FrameMsg_Navigate_Type::NORMAL; 859 common_params_C.navigation_type = FrameMsg_Navigate_Type::NORMAL;
860 common_params_C.transition = ui::PAGE_TRANSITION_FORWARD_BACK; 860 common_params_C.transition = ui::PAGE_TRANSITION_FORWARD_BACK;
861 request_params_C.current_history_list_length = 4; 861 request_params_C.current_history_list_length = 4;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 request_params.page_state = state_A; 895 request_params.page_state = state_A;
896 NavigateMainFrame(common_params, StartNavigationParams(), request_params); 896 NavigateMainFrame(common_params, StartNavigationParams(), request_params);
897 ProcessPendingMessages(); 897 ProcessPendingMessages();
898 898
899 // Now ensure that the UpdateState message we receive is consistent 899 // Now ensure that the UpdateState message we receive is consistent
900 // and represents page C in both page_id and state. 900 // and represents page C in both page_id and state.
901 const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching( 901 const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching(
902 ViewHostMsg_UpdateState::ID); 902 ViewHostMsg_UpdateState::ID);
903 ASSERT_TRUE(msg); 903 ASSERT_TRUE(msg);
904 ViewHostMsg_UpdateState::Read(msg, &param); 904 ViewHostMsg_UpdateState::Read(msg, &param);
905 int page_id = get<0>(param); 905 int page_id = base::get<0>(param);
906 PageState state = get<1>(param); 906 PageState state = base::get<1>(param);
907 EXPECT_EQ(page_id_C, page_id); 907 EXPECT_EQ(page_id_C, page_id);
908 EXPECT_NE(state_A, state); 908 EXPECT_NE(state_A, state);
909 EXPECT_NE(state_B, state); 909 EXPECT_NE(state_B, state);
910 EXPECT_EQ(state_C, state); 910 EXPECT_EQ(state_C, state);
911 } 911 }
912 912
913 // Test that stale back/forward navigations arriving from the browser are 913 // Test that stale back/forward navigations arriving from the browser are
914 // ignored. See http://crbug.com/86758. 914 // ignored. See http://crbug.com/86758.
915 TEST_F(RenderViewImplTest, StaleNavigationsIgnored) { 915 TEST_F(RenderViewImplTest, StaleNavigationsIgnored) {
916 // Load page A. 916 // Load page A.
917 LoadHTML("<div id=pagename>Page A</div>"); 917 LoadHTML("<div id=pagename>Page A</div>");
918 EXPECT_EQ(1, view()->history_list_length_); 918 EXPECT_EQ(1, view()->history_list_length_);
919 EXPECT_EQ(0, view()->history_list_offset_); 919 EXPECT_EQ(0, view()->history_list_offset_);
920 920
921 // Load page B, which will trigger an UpdateState message for page A. 921 // Load page B, which will trigger an UpdateState message for page A.
922 LoadHTML("<div id=pagename>Page B</div>"); 922 LoadHTML("<div id=pagename>Page B</div>");
923 EXPECT_EQ(2, view()->history_list_length_); 923 EXPECT_EQ(2, view()->history_list_length_);
924 EXPECT_EQ(1, view()->history_list_offset_); 924 EXPECT_EQ(1, view()->history_list_offset_);
925 925
926 // Check for a valid UpdateState message for page A. 926 // Check for a valid UpdateState message for page A.
927 ProcessPendingMessages(); 927 ProcessPendingMessages();
928 const IPC::Message* msg_A = render_thread_->sink().GetUniqueMessageMatching( 928 const IPC::Message* msg_A = render_thread_->sink().GetUniqueMessageMatching(
929 ViewHostMsg_UpdateState::ID); 929 ViewHostMsg_UpdateState::ID);
930 ASSERT_TRUE(msg_A); 930 ASSERT_TRUE(msg_A);
931 ViewHostMsg_UpdateState::Param param; 931 ViewHostMsg_UpdateState::Param param;
932 ViewHostMsg_UpdateState::Read(msg_A, &param); 932 ViewHostMsg_UpdateState::Read(msg_A, &param);
933 int page_id_A = get<0>(param); 933 int page_id_A = base::get<0>(param);
934 PageState state_A = get<1>(param); 934 PageState state_A = base::get<1>(param);
935 EXPECT_EQ(1, page_id_A); 935 EXPECT_EQ(1, page_id_A);
936 render_thread_->sink().ClearMessages(); 936 render_thread_->sink().ClearMessages();
937 937
938 // Back to page A (nav_entry_id 1) and commit. 938 // Back to page A (nav_entry_id 1) and commit.
939 CommonNavigationParams common_params_A; 939 CommonNavigationParams common_params_A;
940 RequestNavigationParams request_params_A; 940 RequestNavigationParams request_params_A;
941 common_params_A.navigation_type = FrameMsg_Navigate_Type::NORMAL; 941 common_params_A.navigation_type = FrameMsg_Navigate_Type::NORMAL;
942 common_params_A.transition = ui::PAGE_TRANSITION_FORWARD_BACK; 942 common_params_A.transition = ui::PAGE_TRANSITION_FORWARD_BACK;
943 request_params_A.current_history_list_length = 2; 943 request_params_A.current_history_list_length = 2;
944 request_params_A.current_history_list_offset = 1; 944 request_params_A.current_history_list_offset = 1;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 render_thread_->sink().ClearMessages(); 1053 render_thread_->sink().ClearMessages();
1054 1054
1055 // Update the IME status and verify if our IME backend sends an IPC message 1055 // Update the IME status and verify if our IME backend sends an IPC message
1056 // to activate IMEs. 1056 // to activate IMEs.
1057 view()->UpdateTextInputType(); 1057 view()->UpdateTextInputType();
1058 const IPC::Message* msg = render_thread_->sink().GetMessageAt(0); 1058 const IPC::Message* msg = render_thread_->sink().GetMessageAt(0);
1059 EXPECT_TRUE(msg != NULL); 1059 EXPECT_TRUE(msg != NULL);
1060 EXPECT_EQ(ViewHostMsg_TextInputTypeChanged::ID, msg->type()); 1060 EXPECT_EQ(ViewHostMsg_TextInputTypeChanged::ID, msg->type());
1061 ViewHostMsg_TextInputTypeChanged::Param params; 1061 ViewHostMsg_TextInputTypeChanged::Param params;
1062 ViewHostMsg_TextInputTypeChanged::Read(msg, &params); 1062 ViewHostMsg_TextInputTypeChanged::Read(msg, &params);
1063 ui::TextInputType type = get<0>(params); 1063 ui::TextInputType type = base::get<0>(params);
1064 ui::TextInputMode input_mode = get<1>(params); 1064 ui::TextInputMode input_mode = base::get<1>(params);
1065 bool can_compose_inline = get<2>(params); 1065 bool can_compose_inline = base::get<2>(params);
1066 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, type); 1066 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, type);
1067 EXPECT_EQ(true, can_compose_inline); 1067 EXPECT_EQ(true, can_compose_inline);
1068 1068
1069 // Move the input focus to the second <input> element, where we should 1069 // Move the input focus to the second <input> element, where we should
1070 // de-activate IMEs. 1070 // de-activate IMEs.
1071 ExecuteJavaScript("document.getElementById('test2').focus();"); 1071 ExecuteJavaScript("document.getElementById('test2').focus();");
1072 ProcessPendingMessages(); 1072 ProcessPendingMessages();
1073 render_thread_->sink().ClearMessages(); 1073 render_thread_->sink().ClearMessages();
1074 1074
1075 // Update the IME status and verify if our IME backend sends an IPC message 1075 // Update the IME status and verify if our IME backend sends an IPC message
1076 // to de-activate IMEs. 1076 // to de-activate IMEs.
1077 view()->UpdateTextInputType(); 1077 view()->UpdateTextInputType();
1078 msg = render_thread_->sink().GetMessageAt(0); 1078 msg = render_thread_->sink().GetMessageAt(0);
1079 EXPECT_TRUE(msg != NULL); 1079 EXPECT_TRUE(msg != NULL);
1080 EXPECT_EQ(ViewHostMsg_TextInputTypeChanged::ID, msg->type()); 1080 EXPECT_EQ(ViewHostMsg_TextInputTypeChanged::ID, msg->type());
1081 ViewHostMsg_TextInputTypeChanged::Read(msg, & params); 1081 ViewHostMsg_TextInputTypeChanged::Read(msg, & params);
1082 type = get<0>(params); 1082 type = base::get<0>(params);
1083 input_mode = get<1>(params); 1083 input_mode = base::get<1>(params);
1084 EXPECT_EQ(ui::TEXT_INPUT_TYPE_PASSWORD, type); 1084 EXPECT_EQ(ui::TEXT_INPUT_TYPE_PASSWORD, type);
1085 1085
1086 for (size_t i = 0; i < arraysize(kInputModeTestCases); i++) { 1086 for (size_t i = 0; i < arraysize(kInputModeTestCases); i++) {
1087 const InputModeTestCase* test_case = &kInputModeTestCases[i]; 1087 const InputModeTestCase* test_case = &kInputModeTestCases[i];
1088 std::string javascript = 1088 std::string javascript =
1089 base::StringPrintf("document.getElementById('%s').focus();", 1089 base::StringPrintf("document.getElementById('%s').focus();",
1090 test_case->input_id); 1090 test_case->input_id);
1091 // Move the input focus to the target <input> element, where we should 1091 // Move the input focus to the target <input> element, where we should
1092 // activate IMEs. 1092 // activate IMEs.
1093 ExecuteJavaScriptAndReturnIntValue(base::ASCIIToUTF16(javascript), NULL); 1093 ExecuteJavaScriptAndReturnIntValue(base::ASCIIToUTF16(javascript), NULL);
1094 ProcessPendingMessages(); 1094 ProcessPendingMessages();
1095 render_thread_->sink().ClearMessages(); 1095 render_thread_->sink().ClearMessages();
1096 1096
1097 // Update the IME status and verify if our IME backend sends an IPC 1097 // Update the IME status and verify if our IME backend sends an IPC
1098 // message to activate IMEs. 1098 // message to activate IMEs.
1099 view()->UpdateTextInputType(); 1099 view()->UpdateTextInputType();
1100 const IPC::Message* msg = render_thread_->sink().GetMessageAt(0); 1100 const IPC::Message* msg = render_thread_->sink().GetMessageAt(0);
1101 EXPECT_TRUE(msg != NULL); 1101 EXPECT_TRUE(msg != NULL);
1102 EXPECT_EQ(ViewHostMsg_TextInputTypeChanged::ID, msg->type()); 1102 EXPECT_EQ(ViewHostMsg_TextInputTypeChanged::ID, msg->type());
1103 ViewHostMsg_TextInputTypeChanged::Read(msg, & params); 1103 ViewHostMsg_TextInputTypeChanged::Read(msg, & params);
1104 type = get<0>(params); 1104 type = base::get<0>(params);
1105 input_mode = get<1>(params); 1105 input_mode = base::get<1>(params);
1106 EXPECT_EQ(test_case->expected_mode, input_mode); 1106 EXPECT_EQ(test_case->expected_mode, input_mode);
1107 } 1107 }
1108 } 1108 }
1109 } 1109 }
1110 1110
1111 // Test that our IME backend can compose CJK words. 1111 // Test that our IME backend can compose CJK words.
1112 // Our IME front-end sends many platform-independent messages to the IME backend 1112 // Our IME front-end sends many platform-independent messages to the IME backend
1113 // while it composes CJK words. This test sends the minimal messages captured 1113 // while it composes CJK words. This test sends the minimal messages captured
1114 // on my local environment directly to the IME backend to verify if the backend 1114 // on my local environment directly to the IME backend to verify if the backend
1115 // can compose CJK words without any problems. 1115 // can compose CJK words without any problems.
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after
2220 LoadHTML("<input id='test1' value='hello1'></input>" 2220 LoadHTML("<input id='test1' value='hello1'></input>"
2221 "<input id='test2' value='hello2'></input>"); 2221 "<input id='test2' value='hello2'></input>");
2222 2222
2223 ExecuteJavaScript("document.getElementById('test1').focus();"); 2223 ExecuteJavaScript("document.getElementById('test1').focus();");
2224 const IPC::Message* msg1 = render_thread_->sink().GetFirstMessageMatching( 2224 const IPC::Message* msg1 = render_thread_->sink().GetFirstMessageMatching(
2225 ViewHostMsg_FocusedNodeChanged::ID); 2225 ViewHostMsg_FocusedNodeChanged::ID);
2226 EXPECT_TRUE(msg1); 2226 EXPECT_TRUE(msg1);
2227 2227
2228 ViewHostMsg_FocusedNodeChanged::Param params; 2228 ViewHostMsg_FocusedNodeChanged::Param params;
2229 ViewHostMsg_FocusedNodeChanged::Read(msg1, &params); 2229 ViewHostMsg_FocusedNodeChanged::Read(msg1, &params);
2230 EXPECT_TRUE(get<0>(params)); 2230 EXPECT_TRUE(base::get<0>(params));
2231 render_thread_->sink().ClearMessages(); 2231 render_thread_->sink().ClearMessages();
2232 2232
2233 ExecuteJavaScript("document.getElementById('test2').focus();"); 2233 ExecuteJavaScript("document.getElementById('test2').focus();");
2234 const IPC::Message* msg2 = render_thread_->sink().GetFirstMessageMatching( 2234 const IPC::Message* msg2 = render_thread_->sink().GetFirstMessageMatching(
2235 ViewHostMsg_FocusedNodeChanged::ID); 2235 ViewHostMsg_FocusedNodeChanged::ID);
2236 EXPECT_TRUE(msg2); 2236 EXPECT_TRUE(msg2);
2237 ViewHostMsg_FocusedNodeChanged::Read(msg2, &params); 2237 ViewHostMsg_FocusedNodeChanged::Read(msg2, &params);
2238 EXPECT_TRUE(get<0>(params)); 2238 EXPECT_TRUE(base::get<0>(params));
2239 render_thread_->sink().ClearMessages(); 2239 render_thread_->sink().ClearMessages();
2240 2240
2241 view()->webview()->clearFocusedElement(); 2241 view()->webview()->clearFocusedElement();
2242 const IPC::Message* msg3 = render_thread_->sink().GetFirstMessageMatching( 2242 const IPC::Message* msg3 = render_thread_->sink().GetFirstMessageMatching(
2243 ViewHostMsg_FocusedNodeChanged::ID); 2243 ViewHostMsg_FocusedNodeChanged::ID);
2244 EXPECT_TRUE(msg3); 2244 EXPECT_TRUE(msg3);
2245 ViewHostMsg_FocusedNodeChanged::Read(msg3, &params); 2245 ViewHostMsg_FocusedNodeChanged::Read(msg3, &params);
2246 EXPECT_FALSE(get<0>(params)); 2246 EXPECT_FALSE(base::get<0>(params));
2247 render_thread_->sink().ClearMessages(); 2247 render_thread_->sink().ClearMessages();
2248 } 2248 }
2249 2249
2250 TEST_F(RenderViewImplTest, ServiceWorkerNetworkProviderSetup) { 2250 TEST_F(RenderViewImplTest, ServiceWorkerNetworkProviderSetup) {
2251 ServiceWorkerNetworkProvider* provider = NULL; 2251 ServiceWorkerNetworkProvider* provider = NULL;
2252 RequestExtraData* extra_data = NULL; 2252 RequestExtraData* extra_data = NULL;
2253 2253
2254 // Make sure each new document has a new provider and 2254 // Make sure each new document has a new provider and
2255 // that the main request is tagged with the provider's id. 2255 // that the main request is tagged with the provider's id.
2256 LoadHTML("<b>A Document</b>"); 2256 LoadHTML("<b>A Document</b>");
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
2432 FROM_HERE, 2432 FROM_HERE,
2433 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); 2433 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this)));
2434 ExecuteJavaScript("debugger;"); 2434 ExecuteJavaScript("debugger;");
2435 2435
2436 // CloseWhilePaused should resume execution and continue here. 2436 // CloseWhilePaused should resume execution and continue here.
2437 EXPECT_FALSE(IsPaused()); 2437 EXPECT_FALSE(IsPaused());
2438 Detach(); 2438 Detach();
2439 } 2439 }
2440 2440
2441 } // namespace content 2441 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_proxy.cc ('k') | content/renderer/render_widget_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698