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

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

Issue 1100763002: Inject CanAddURLToHistory into TopSitesImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@prefs
Patch Set: Fix error introduced during rebase Created 5 years, 7 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_impl.cc ('k') | content/renderer/render_view_impl.h » ('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/memory/shared_memory.h" 8 #include "base/memory/shared_memory.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 ui::KeyEvent event1(xevent); 216 ui::KeyEvent event1(xevent);
217 NativeWebKeyboardEvent keydown_event(event1); 217 NativeWebKeyboardEvent keydown_event(event1);
218 SendNativeKeyEvent(keydown_event); 218 SendNativeKeyEvent(keydown_event);
219 219
220 // X11 doesn't actually have native character events, but give the test 220 // X11 doesn't actually have native character events, but give the test
221 // what it wants. 221 // what it wants.
222 xevent.InitKeyEvent(ui::ET_KEY_PRESSED, 222 xevent.InitKeyEvent(ui::ET_KEY_PRESSED,
223 static_cast<ui::KeyboardCode>(key_code), 223 static_cast<ui::KeyboardCode>(key_code),
224 flags); 224 flags);
225 ui::KeyEvent event2(xevent); 225 ui::KeyEvent event2(xevent);
226 event2.set_character( 226 event2.set_character(GetCharacterFromKeyCode(event2.key_code(),
227 DomCodeToUsLayoutCharacter(event2.code(), event2.flags())); 227 event2.flags()));
228 ui::KeyEventTestApi test_event2(&event2); 228 ui::KeyEventTestApi test_event2(&event2);
229 test_event2.set_is_char(true); 229 test_event2.set_is_char(true);
230 NativeWebKeyboardEvent char_event(event2); 230 NativeWebKeyboardEvent char_event(event2);
231 SendNativeKeyEvent(char_event); 231 SendNativeKeyEvent(char_event);
232 232
233 xevent.InitKeyEvent(ui::ET_KEY_RELEASED, 233 xevent.InitKeyEvent(ui::ET_KEY_RELEASED,
234 static_cast<ui::KeyboardCode>(key_code), 234 static_cast<ui::KeyboardCode>(key_code),
235 flags); 235 flags);
236 ui::KeyEvent event3(xevent); 236 ui::KeyEvent event3(xevent);
237 NativeWebKeyboardEvent keyup_event(event3); 237 NativeWebKeyboardEvent keyup_event(event3);
238 SendNativeKeyEvent(keyup_event); 238 SendNativeKeyEvent(keyup_event);
239 239
240 long c = DomCodeToUsLayoutCharacter( 240 long c = GetCharacterFromKeyCode(static_cast<ui::KeyboardCode>(key_code),
241 UsLayoutKeyboardCodeToDomCode(static_cast<ui::KeyboardCode>(key_code)), 241 flags);
242 flags);
243 output->assign(1, static_cast<base::char16>(c)); 242 output->assign(1, static_cast<base::char16>(c));
244 return 1; 243 return 1;
245 #elif defined(USE_OZONE) 244 #elif defined(USE_OZONE)
246 const int flags = ConvertMockKeyboardModifier(modifiers); 245 const int flags = ConvertMockKeyboardModifier(modifiers);
247 246
248 ui::KeyEvent keydown_event(ui::ET_KEY_PRESSED, 247 ui::KeyEvent keydown_event(ui::ET_KEY_PRESSED,
249 static_cast<ui::KeyboardCode>(key_code), 248 static_cast<ui::KeyboardCode>(key_code),
250 flags); 249 flags);
251 NativeWebKeyboardEvent keydown_web_event(keydown_event); 250 NativeWebKeyboardEvent keydown_web_event(keydown_event);
252 SendNativeKeyEvent(keydown_web_event); 251 SendNativeKeyEvent(keydown_web_event);
253 252
254 ui::KeyEvent char_event(keydown_event.GetCharacter(), 253 ui::KeyEvent char_event(keydown_event.GetCharacter(),
255 static_cast<ui::KeyboardCode>(key_code), 254 static_cast<ui::KeyboardCode>(key_code),
256 flags); 255 flags);
257 NativeWebKeyboardEvent char_web_event(char_event); 256 NativeWebKeyboardEvent char_web_event(char_event);
258 SendNativeKeyEvent(char_web_event); 257 SendNativeKeyEvent(char_web_event);
259 258
260 ui::KeyEvent keyup_event(ui::ET_KEY_RELEASED, 259 ui::KeyEvent keyup_event(ui::ET_KEY_RELEASED,
261 static_cast<ui::KeyboardCode>(key_code), 260 static_cast<ui::KeyboardCode>(key_code),
262 flags); 261 flags);
263 NativeWebKeyboardEvent keyup_web_event(keyup_event); 262 NativeWebKeyboardEvent keyup_web_event(keyup_event);
264 SendNativeKeyEvent(keyup_web_event); 263 SendNativeKeyEvent(keyup_web_event);
265 264
266 long c = DomCodeToUsLayoutCharacter( 265 long c = GetCharacterFromKeyCode(static_cast<ui::KeyboardCode>(key_code),
267 UsLayoutKeyboardCodeToDomCode(static_cast<ui::KeyboardCode>(key_code)), 266 flags);
268 flags);
269 output->assign(1, static_cast<base::char16>(c)); 267 output->assign(1, static_cast<base::char16>(c));
270 return 1; 268 return 1;
271 #else 269 #else
272 NOTIMPLEMENTED(); 270 NOTIMPLEMENTED();
273 return L'\0'; 271 return L'\0';
274 #endif 272 #endif
275 } 273 }
276 274
277 void EnablePreferredSizeMode() { 275 void EnablePreferredSizeMode() {
278 view()->OnEnablePreferredSizeChangedMode(); 276 view()->OnEnablePreferredSizeChangedMode();
279 } 277 }
280 278
281 const gfx::Size& GetPreferredSize() { 279 const gfx::Size& GetPreferredSize() {
282 view()->CheckPreferredSize(); 280 view()->CheckPreferredSize();
283 return view()->preferred_size_; 281 return view()->preferred_size_;
284 } 282 }
285 283
286 void SetZoomLevel(double level) { 284 void SetZoomLevel(double level) {
287 view()->OnSetZoomLevelForView(false, level); 285 view()->OnSetZoomLevelForView(false, level);
288 } 286 }
289 287
290 void NavigateFrame(const CommonNavigationParams& common_params, 288 void NavigateMainFrame(const CommonNavigationParams& common_params,
289 const StartNavigationParams& start_params,
290 const RequestNavigationParams& request_params) {
291 NavigateFrame(frame(), common_params, start_params, request_params);
292 }
293
294 void NavigateFrame(RenderFrameImpl* frame,
295 const CommonNavigationParams& common_params,
291 const StartNavigationParams& start_params, 296 const StartNavigationParams& start_params,
292 const RequestNavigationParams& request_params) { 297 const RequestNavigationParams& request_params) {
293 // PlzNavigate 298 // PlzNavigate
294 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 299 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
295 switches::kEnableBrowserSideNavigation)) { 300 switches::kEnableBrowserSideNavigation)) {
296 frame()->OnCommitNavigation(ResourceResponseHead(), common_params.url, 301 frame->OnCommitNavigation(ResourceResponseHead(), common_params.url,
297 common_params, request_params); 302 common_params, request_params);
298 return; 303 return;
299 } 304 }
300 frame()->OnNavigate(common_params, start_params, request_params); 305 frame->OnNavigate(common_params, start_params, request_params);
301 } 306 }
302 307
303 void SwapOut(RenderFrameImpl* frame, 308 void SwapOut(RenderFrameImpl* frame,
304 int proxy_routing_id, 309 int proxy_routing_id,
305 bool is_loading, 310 bool is_loading,
306 const FrameReplicationState& replicated_frame_state) { 311 const FrameReplicationState& replicated_frame_state) {
307 frame->OnSwapOut(proxy_routing_id, is_loading, replicated_frame_state); 312 frame->OnSwapOut(proxy_routing_id, is_loading, replicated_frame_state);
308 } 313 }
309 314
310 void SetEditableSelectionOffsets(int start, int end) { 315 void SetEditableSelectionOffsets(int start, int end) {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 request_params.page_id = -1; 473 request_params.page_id = -1;
469 474
470 // Set up post data. 475 // Set up post data.
471 const unsigned char* raw_data = reinterpret_cast<const unsigned char*>( 476 const unsigned char* raw_data = reinterpret_cast<const unsigned char*>(
472 "post \0\ndata"); 477 "post \0\ndata");
473 const unsigned int length = 11; 478 const unsigned int length = 11;
474 const std::vector<unsigned char> post_data(raw_data, raw_data + length); 479 const std::vector<unsigned char> post_data(raw_data, raw_data + length);
475 start_params.is_post = true; 480 start_params.is_post = true;
476 start_params.browser_initiated_post_data = post_data; 481 start_params.browser_initiated_post_data = post_data;
477 482
478 NavigateFrame(common_params, start_params, request_params); 483 NavigateMainFrame(common_params, start_params, request_params);
479 ProcessPendingMessages(); 484 ProcessPendingMessages();
480 485
481 const IPC::Message* frame_navigate_msg = 486 const IPC::Message* frame_navigate_msg =
482 render_thread_->sink().GetUniqueMessageMatching( 487 render_thread_->sink().GetUniqueMessageMatching(
483 FrameHostMsg_DidCommitProvisionalLoad::ID); 488 FrameHostMsg_DidCommitProvisionalLoad::ID);
484 EXPECT_TRUE(frame_navigate_msg); 489 EXPECT_TRUE(frame_navigate_msg);
485 490
486 FrameHostMsg_DidCommitProvisionalLoad::Param host_nav_params; 491 FrameHostMsg_DidCommitProvisionalLoad::Param host_nav_params;
487 FrameHostMsg_DidCommitProvisionalLoad::Read(frame_navigate_msg, 492 FrameHostMsg_DidCommitProvisionalLoad::Read(frame_navigate_msg,
488 &host_nav_params); 493 &host_nav_params);
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 // update for the swapped out URL. (http://crbug.com/72235) 672 // update for the swapped out URL. (http://crbug.com/72235)
668 CommonNavigationParams common_params; 673 CommonNavigationParams common_params;
669 RequestNavigationParams request_params; 674 RequestNavigationParams request_params;
670 common_params.url = GURL("data:text/html,<div>Page B</div>"); 675 common_params.url = GURL("data:text/html,<div>Page B</div>");
671 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; 676 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL;
672 common_params.transition = ui::PAGE_TRANSITION_TYPED; 677 common_params.transition = ui::PAGE_TRANSITION_TYPED;
673 request_params.current_history_list_length = 1; 678 request_params.current_history_list_length = 1;
674 request_params.current_history_list_offset = 0; 679 request_params.current_history_list_offset = 0;
675 request_params.pending_history_list_offset = 1; 680 request_params.pending_history_list_offset = 1;
676 request_params.page_id = -1; 681 request_params.page_id = -1;
677 NavigateFrame(common_params, StartNavigationParams(), request_params); 682 NavigateMainFrame(common_params, StartNavigationParams(), request_params);
678 ProcessPendingMessages(); 683 ProcessPendingMessages();
679 const IPC::Message* msg3 = render_thread_->sink().GetUniqueMessageMatching( 684 const IPC::Message* msg3 = render_thread_->sink().GetUniqueMessageMatching(
680 ViewHostMsg_UpdateState::ID); 685 ViewHostMsg_UpdateState::ID);
681 EXPECT_FALSE(msg3); 686 EXPECT_FALSE(msg3);
682 } 687 }
683 688
684 // Ensure the RenderViewImpl reloads the previous page if a reload request 689 // Ensure the RenderViewImpl reloads the previous page if a reload request
685 // arrives while it is showing swappedout://. http://crbug.com/143155. 690 // arrives while it is showing swappedout://. http://crbug.com/143155.
686 TEST_F(RenderViewImplTest, ReloadWhileSwappedOut) { 691 TEST_F(RenderViewImplTest, ReloadWhileSwappedOut) {
687 // Load page A. 692 // Load page A.
(...skipping 17 matching lines...) Expand all
705 // Back to page A (page_id 1) and commit. 710 // Back to page A (page_id 1) and commit.
706 CommonNavigationParams common_params_A; 711 CommonNavigationParams common_params_A;
707 RequestNavigationParams request_params_A; 712 RequestNavigationParams request_params_A;
708 common_params_A.navigation_type = FrameMsg_Navigate_Type::NORMAL; 713 common_params_A.navigation_type = FrameMsg_Navigate_Type::NORMAL;
709 common_params_A.transition = ui::PAGE_TRANSITION_FORWARD_BACK; 714 common_params_A.transition = ui::PAGE_TRANSITION_FORWARD_BACK;
710 request_params_A.current_history_list_length = 2; 715 request_params_A.current_history_list_length = 2;
711 request_params_A.current_history_list_offset = 1; 716 request_params_A.current_history_list_offset = 1;
712 request_params_A.pending_history_list_offset = 0; 717 request_params_A.pending_history_list_offset = 0;
713 request_params_A.page_id = 1; 718 request_params_A.page_id = 1;
714 request_params_A.page_state = state_A; 719 request_params_A.page_state = state_A;
715 NavigateFrame(common_params_A, StartNavigationParams(), request_params_A); 720 NavigateMainFrame(common_params_A, StartNavigationParams(), request_params_A);
716 EXPECT_EQ(1, view()->historyBackListCount()); 721 EXPECT_EQ(1, view()->historyBackListCount());
717 EXPECT_EQ(2, view()->historyBackListCount() + 722 EXPECT_EQ(2, view()->historyBackListCount() +
718 view()->historyForwardListCount() + 1); 723 view()->historyForwardListCount() + 1);
719 ProcessPendingMessages(); 724 ProcessPendingMessages();
720 725
721 // Respond to a swap out request. 726 // Respond to a swap out request.
722 SwapOut(frame(), kProxyRoutingId, true, content::FrameReplicationState()); 727 SwapOut(frame(), kProxyRoutingId, true, content::FrameReplicationState());
723 728
724 // Check for a OnSwapOutACK. 729 // Check for a OnSwapOutACK.
725 const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching( 730 const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching(
726 FrameHostMsg_SwapOut_ACK::ID); 731 FrameHostMsg_SwapOut_ACK::ID);
727 ASSERT_TRUE(msg); 732 ASSERT_TRUE(msg);
728 render_thread_->sink().ClearMessages(); 733 render_thread_->sink().ClearMessages();
729 734
730 // It is possible to get a reload request at this point, containing the 735 // It is possible to get a reload request at this point, containing the
731 // params.page_state of the initial page (e.g., if the new page fails the 736 // params.page_state of the initial page (e.g., if the new page fails the
732 // provisional load in the renderer process, after we unload the old page). 737 // provisional load in the renderer process, after we unload the old page).
733 // Ensure the old page gets reloaded, not swappedout://. 738 // Ensure the old page gets reloaded, not swappedout://.
734 CommonNavigationParams common_params; 739 CommonNavigationParams common_params;
735 RequestNavigationParams request_params; 740 RequestNavigationParams request_params;
736 common_params.url = GURL("data:text/html,<div>Page A</div>"); 741 common_params.url = GURL("data:text/html,<div>Page A</div>");
737 common_params.navigation_type = FrameMsg_Navigate_Type::RELOAD; 742 common_params.navigation_type = FrameMsg_Navigate_Type::RELOAD;
738 common_params.transition = ui::PAGE_TRANSITION_RELOAD; 743 common_params.transition = ui::PAGE_TRANSITION_RELOAD;
739 request_params.current_history_list_length = 2; 744 request_params.current_history_list_length = 2;
740 request_params.current_history_list_offset = 0; 745 request_params.current_history_list_offset = 0;
741 request_params.pending_history_list_offset = 0; 746 request_params.pending_history_list_offset = 0;
742 request_params.page_id = 1; 747 request_params.page_id = 1;
743 request_params.page_state = state_A; 748 request_params.page_state = state_A;
744 NavigateFrame(common_params, StartNavigationParams(), request_params); 749 NavigateMainFrame(common_params, StartNavigationParams(), request_params);
745 ProcessPendingMessages(); 750 ProcessPendingMessages();
746 751
747 // Verify page A committed, not swappedout://. 752 // Verify page A committed, not swappedout://.
748 const IPC::Message* frame_navigate_msg = 753 const IPC::Message* frame_navigate_msg =
749 render_thread_->sink().GetUniqueMessageMatching( 754 render_thread_->sink().GetUniqueMessageMatching(
750 FrameHostMsg_DidCommitProvisionalLoad::ID); 755 FrameHostMsg_DidCommitProvisionalLoad::ID);
751 EXPECT_TRUE(frame_navigate_msg); 756 EXPECT_TRUE(frame_navigate_msg);
752 757
753 // Read URL out of the parent trait of the params object. 758 // Read URL out of the parent trait of the params object.
754 FrameHostMsg_DidCommitProvisionalLoad::Param commit_load_params; 759 FrameHostMsg_DidCommitProvisionalLoad::Param commit_load_params;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 // Go back to C and commit, preparing for our real test. 857 // Go back to C and commit, preparing for our real test.
853 CommonNavigationParams common_params_C; 858 CommonNavigationParams common_params_C;
854 RequestNavigationParams request_params_C; 859 RequestNavigationParams request_params_C;
855 common_params_C.navigation_type = FrameMsg_Navigate_Type::NORMAL; 860 common_params_C.navigation_type = FrameMsg_Navigate_Type::NORMAL;
856 common_params_C.transition = ui::PAGE_TRANSITION_FORWARD_BACK; 861 common_params_C.transition = ui::PAGE_TRANSITION_FORWARD_BACK;
857 request_params_C.current_history_list_length = 4; 862 request_params_C.current_history_list_length = 4;
858 request_params_C.current_history_list_offset = 3; 863 request_params_C.current_history_list_offset = 3;
859 request_params_C.pending_history_list_offset = 2; 864 request_params_C.pending_history_list_offset = 2;
860 request_params_C.page_id = 3; 865 request_params_C.page_id = 3;
861 request_params_C.page_state = state_C; 866 request_params_C.page_state = state_C;
862 NavigateFrame(common_params_C, StartNavigationParams(), request_params_C); 867 NavigateMainFrame(common_params_C, StartNavigationParams(), request_params_C);
863 ProcessPendingMessages(); 868 ProcessPendingMessages();
864 render_thread_->sink().ClearMessages(); 869 render_thread_->sink().ClearMessages();
865 870
866 // Go back twice quickly, such that page B does not have a chance to commit. 871 // Go back twice quickly, such that page B does not have a chance to commit.
867 // This leads to two changes to the back/forward list but only one change to 872 // This leads to two changes to the back/forward list but only one change to
868 // the RenderView's page ID. 873 // the RenderView's page ID.
869 874
870 // Back to page B (page_id 2), without committing. 875 // Back to page B (page_id 2), without committing.
871 CommonNavigationParams common_params_B; 876 CommonNavigationParams common_params_B;
872 RequestNavigationParams request_params_B; 877 RequestNavigationParams request_params_B;
873 common_params_B.navigation_type = FrameMsg_Navigate_Type::NORMAL; 878 common_params_B.navigation_type = FrameMsg_Navigate_Type::NORMAL;
874 common_params_B.transition = ui::PAGE_TRANSITION_FORWARD_BACK; 879 common_params_B.transition = ui::PAGE_TRANSITION_FORWARD_BACK;
875 request_params_B.current_history_list_length = 4; 880 request_params_B.current_history_list_length = 4;
876 request_params_B.current_history_list_offset = 2; 881 request_params_B.current_history_list_offset = 2;
877 request_params_B.pending_history_list_offset = 1; 882 request_params_B.pending_history_list_offset = 1;
878 request_params_B.page_id = 2; 883 request_params_B.page_id = 2;
879 request_params_B.page_state = state_B; 884 request_params_B.page_state = state_B;
880 NavigateFrame(common_params_B, StartNavigationParams(), request_params_B); 885 NavigateMainFrame(common_params_B, StartNavigationParams(), request_params_B);
881 886
882 // Back to page A (page_id 1) and commit. 887 // Back to page A (page_id 1) and commit.
883 CommonNavigationParams common_params; 888 CommonNavigationParams common_params;
884 RequestNavigationParams request_params; 889 RequestNavigationParams request_params;
885 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; 890 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL;
886 common_params.transition = ui::PAGE_TRANSITION_FORWARD_BACK; 891 common_params.transition = ui::PAGE_TRANSITION_FORWARD_BACK;
887 request_params.current_history_list_length = 4; 892 request_params.current_history_list_length = 4;
888 request_params.current_history_list_offset = 2; 893 request_params.current_history_list_offset = 2;
889 request_params.pending_history_list_offset = 0; 894 request_params.pending_history_list_offset = 0;
890 request_params.page_id = 1; 895 request_params.page_id = 1;
891 request_params.page_state = state_A; 896 request_params.page_state = state_A;
892 NavigateFrame(common_params, StartNavigationParams(), request_params); 897 NavigateMainFrame(common_params, StartNavigationParams(), request_params);
893 ProcessPendingMessages(); 898 ProcessPendingMessages();
894 899
895 // Now ensure that the UpdateState message we receive is consistent 900 // Now ensure that the UpdateState message we receive is consistent
896 // and represents page C in both page_id and state. 901 // and represents page C in both page_id and state.
897 const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching( 902 const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching(
898 ViewHostMsg_UpdateState::ID); 903 ViewHostMsg_UpdateState::ID);
899 ASSERT_TRUE(msg); 904 ASSERT_TRUE(msg);
900 ViewHostMsg_UpdateState::Read(msg, &param); 905 ViewHostMsg_UpdateState::Read(msg, &param);
901 int page_id = get<0>(param); 906 int page_id = get<0>(param);
902 PageState state = get<1>(param); 907 PageState state = get<1>(param);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 // Back to page A (page_id 1) and commit. 939 // Back to page A (page_id 1) and commit.
935 CommonNavigationParams common_params_A; 940 CommonNavigationParams common_params_A;
936 RequestNavigationParams request_params_A; 941 RequestNavigationParams request_params_A;
937 common_params_A.navigation_type = FrameMsg_Navigate_Type::NORMAL; 942 common_params_A.navigation_type = FrameMsg_Navigate_Type::NORMAL;
938 common_params_A.transition = ui::PAGE_TRANSITION_FORWARD_BACK; 943 common_params_A.transition = ui::PAGE_TRANSITION_FORWARD_BACK;
939 request_params_A.current_history_list_length = 2; 944 request_params_A.current_history_list_length = 2;
940 request_params_A.current_history_list_offset = 1; 945 request_params_A.current_history_list_offset = 1;
941 request_params_A.pending_history_list_offset = 0; 946 request_params_A.pending_history_list_offset = 0;
942 request_params_A.page_id = 1; 947 request_params_A.page_id = 1;
943 request_params_A.page_state = state_A; 948 request_params_A.page_state = state_A;
944 NavigateFrame(common_params_A, StartNavigationParams(), request_params_A); 949 NavigateMainFrame(common_params_A, StartNavigationParams(), request_params_A);
945 ProcessPendingMessages(); 950 ProcessPendingMessages();
946 951
947 // A new navigation commits, clearing the forward history. 952 // A new navigation commits, clearing the forward history.
948 LoadHTML("<div>Page C</div>"); 953 LoadHTML("<div>Page C</div>");
949 EXPECT_EQ(2, view()->history_list_length_); 954 EXPECT_EQ(2, view()->history_list_length_);
950 EXPECT_EQ(1, view()->history_list_offset_); 955 EXPECT_EQ(1, view()->history_list_offset_);
951 EXPECT_EQ(3, view()->page_id_); // page C is now page id 3 956 EXPECT_EQ(3, view()->page_id_); // page C is now page id 3
952 957
953 // The browser then sends a stale navigation to B, which should be ignored. 958 // The browser then sends a stale navigation to B, which should be ignored.
954 CommonNavigationParams common_params_B; 959 CommonNavigationParams common_params_B;
955 RequestNavigationParams request_params_B; 960 RequestNavigationParams request_params_B;
956 common_params_B.navigation_type = FrameMsg_Navigate_Type::NORMAL; 961 common_params_B.navigation_type = FrameMsg_Navigate_Type::NORMAL;
957 common_params_B.transition = ui::PAGE_TRANSITION_FORWARD_BACK; 962 common_params_B.transition = ui::PAGE_TRANSITION_FORWARD_BACK;
958 request_params_B.current_history_list_length = 2; 963 request_params_B.current_history_list_length = 2;
959 request_params_B.current_history_list_offset = 0; 964 request_params_B.current_history_list_offset = 0;
960 request_params_B.pending_history_list_offset = 1; 965 request_params_B.pending_history_list_offset = 1;
961 request_params_B.page_id = 2; 966 request_params_B.page_id = 2;
962 request_params_B.page_state = 967 request_params_B.page_state =
963 state_A; // Doesn't matter, just has to be present. 968 state_A; // Doesn't matter, just has to be present.
964 NavigateFrame(common_params_B, StartNavigationParams(), request_params_B); 969 NavigateMainFrame(common_params_B, StartNavigationParams(), request_params_B);
965 970
966 // State should be unchanged. 971 // State should be unchanged.
967 EXPECT_EQ(2, view()->history_list_length_); 972 EXPECT_EQ(2, view()->history_list_length_);
968 EXPECT_EQ(1, view()->history_list_offset_); 973 EXPECT_EQ(1, view()->history_list_offset_);
969 EXPECT_EQ(3, view()->page_id_); // page C, not page B 974 EXPECT_EQ(3, view()->page_id_); // page C, not page B
970 975
971 // Check for a valid DidDropNavigation message. 976 // Check for a valid DidDropNavigation message.
972 ProcessPendingMessages(); 977 ProcessPendingMessages();
973 const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching( 978 const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching(
974 FrameHostMsg_DidDropNavigation::ID); 979 FrameHostMsg_DidDropNavigation::ID);
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
1669 error.domain = WebString::fromUTF8(net::kErrorDomain); 1674 error.domain = WebString::fromUTF8(net::kErrorDomain);
1670 error.reason = net::ERR_FILE_NOT_FOUND; 1675 error.reason = net::ERR_FILE_NOT_FOUND;
1671 error.unreachableURL = GURL("http://foo"); 1676 error.unreachableURL = GURL("http://foo");
1672 WebLocalFrame* web_frame = GetMainFrame(); 1677 WebLocalFrame* web_frame = GetMainFrame();
1673 1678
1674 // Start a load that will reach provisional state synchronously, 1679 // Start a load that will reach provisional state synchronously,
1675 // but won't complete synchronously. 1680 // but won't complete synchronously.
1676 CommonNavigationParams common_params; 1681 CommonNavigationParams common_params;
1677 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; 1682 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL;
1678 common_params.url = GURL("data:text/html,test data"); 1683 common_params.url = GURL("data:text/html,test data");
1679 NavigateFrame(common_params, StartNavigationParams(), 1684 NavigateMainFrame(common_params, StartNavigationParams(),
1680 RequestNavigationParams()); 1685 RequestNavigationParams());
1681 1686
1682 // An error occurred. 1687 // An error occurred.
1683 view()->GetMainRenderFrame()->didFailProvisionalLoad( 1688 view()->GetMainRenderFrame()->didFailProvisionalLoad(
1684 web_frame, error, blink::WebStandardCommit); 1689 web_frame, error, blink::WebStandardCommit);
1685 // Frame should exit view-source mode. 1690 // Frame should exit view-source mode.
1686 EXPECT_FALSE(web_frame->isViewSourceModeEnabled()); 1691 EXPECT_FALSE(web_frame->isViewSourceModeEnabled());
1687 } 1692 }
1688 1693
1689 TEST_F(RenderViewImplTest, DidFailProvisionalLoadWithErrorForCancellation) { 1694 TEST_F(RenderViewImplTest, DidFailProvisionalLoadWithErrorForCancellation) {
1690 GetMainFrame()->enableViewSourceMode(true); 1695 GetMainFrame()->enableViewSourceMode(true);
1691 WebURLError error; 1696 WebURLError error;
1692 error.domain = WebString::fromUTF8(net::kErrorDomain); 1697 error.domain = WebString::fromUTF8(net::kErrorDomain);
1693 error.reason = net::ERR_ABORTED; 1698 error.reason = net::ERR_ABORTED;
1694 error.unreachableURL = GURL("http://foo"); 1699 error.unreachableURL = GURL("http://foo");
1695 WebLocalFrame* web_frame = GetMainFrame(); 1700 WebLocalFrame* web_frame = GetMainFrame();
1696 1701
1697 // Start a load that will reach provisional state synchronously, 1702 // Start a load that will reach provisional state synchronously,
1698 // but won't complete synchronously. 1703 // but won't complete synchronously.
1699 CommonNavigationParams common_params; 1704 CommonNavigationParams common_params;
1700 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; 1705 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL;
1701 common_params.url = GURL("data:text/html,test data"); 1706 common_params.url = GURL("data:text/html,test data");
1702 NavigateFrame(common_params, StartNavigationParams(), 1707 NavigateMainFrame(common_params, StartNavigationParams(),
1703 RequestNavigationParams()); 1708 RequestNavigationParams());
1704 1709
1705 // A cancellation occurred. 1710 // A cancellation occurred.
1706 view()->GetMainRenderFrame()->didFailProvisionalLoad( 1711 view()->GetMainRenderFrame()->didFailProvisionalLoad(
1707 web_frame, error, blink::WebStandardCommit); 1712 web_frame, error, blink::WebStandardCommit);
1708 // Frame should stay in view-source mode. 1713 // Frame should stay in view-source mode.
1709 EXPECT_TRUE(web_frame->isViewSourceModeEnabled()); 1714 EXPECT_TRUE(web_frame->isViewSourceModeEnabled());
1710 } 1715 }
1711 1716
1712 // Regression test for http://crbug.com/41562 1717 // Regression test for http://crbug.com/41562
1713 TEST_F(RenderViewImplTest, UpdateTargetURLWithInvalidURL) { 1718 TEST_F(RenderViewImplTest, UpdateTargetURLWithInvalidURL) {
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1890 TEST_F(RenderViewImplTest, ZoomLimit) { 1895 TEST_F(RenderViewImplTest, ZoomLimit) {
1891 const double kMinZoomLevel = ZoomFactorToZoomLevel(kMinimumZoomFactor); 1896 const double kMinZoomLevel = ZoomFactorToZoomLevel(kMinimumZoomFactor);
1892 const double kMaxZoomLevel = ZoomFactorToZoomLevel(kMaximumZoomFactor); 1897 const double kMaxZoomLevel = ZoomFactorToZoomLevel(kMaximumZoomFactor);
1893 1898
1894 // Verifies navigation to a URL with preset zoom level indeed sets the level. 1899 // Verifies navigation to a URL with preset zoom level indeed sets the level.
1895 // Regression test for http://crbug.com/139559, where the level was not 1900 // Regression test for http://crbug.com/139559, where the level was not
1896 // properly set when it is out of the default zoom limits of WebView. 1901 // properly set when it is out of the default zoom limits of WebView.
1897 CommonNavigationParams common_params; 1902 CommonNavigationParams common_params;
1898 common_params.url = GURL("data:text/html,min_zoomlimit_test"); 1903 common_params.url = GURL("data:text/html,min_zoomlimit_test");
1899 view()->OnSetZoomLevelForLoadingURL(common_params.url, kMinZoomLevel); 1904 view()->OnSetZoomLevelForLoadingURL(common_params.url, kMinZoomLevel);
1900 NavigateFrame(common_params, StartNavigationParams(), 1905 NavigateMainFrame(common_params, StartNavigationParams(),
1901 RequestNavigationParams()); 1906 RequestNavigationParams());
1902 ProcessPendingMessages(); 1907 ProcessPendingMessages();
1903 EXPECT_DOUBLE_EQ(kMinZoomLevel, view()->GetWebView()->zoomLevel()); 1908 EXPECT_DOUBLE_EQ(kMinZoomLevel, view()->GetWebView()->zoomLevel());
1904 1909
1905 // It should work even when the zoom limit is temporarily changed in the page. 1910 // It should work even when the zoom limit is temporarily changed in the page.
1906 view()->GetWebView()->zoomLimitsChanged(ZoomFactorToZoomLevel(1.0), 1911 view()->GetWebView()->zoomLimitsChanged(ZoomFactorToZoomLevel(1.0),
1907 ZoomFactorToZoomLevel(1.0)); 1912 ZoomFactorToZoomLevel(1.0));
1908 common_params.url = GURL("data:text/html,max_zoomlimit_test"); 1913 common_params.url = GURL("data:text/html,max_zoomlimit_test");
1909 view()->OnSetZoomLevelForLoadingURL(common_params.url, kMaxZoomLevel); 1914 view()->OnSetZoomLevelForLoadingURL(common_params.url, kMaxZoomLevel);
1910 NavigateFrame(common_params, StartNavigationParams(), 1915 NavigateMainFrame(common_params, StartNavigationParams(),
1911 RequestNavigationParams()); 1916 RequestNavigationParams());
1912 ProcessPendingMessages(); 1917 ProcessPendingMessages();
1913 EXPECT_DOUBLE_EQ(kMaxZoomLevel, view()->GetWebView()->zoomLevel()); 1918 EXPECT_DOUBLE_EQ(kMaxZoomLevel, view()->GetWebView()->zoomLevel());
1914 } 1919 }
1915 1920
1916 TEST_F(RenderViewImplTest, SetEditableSelectionAndComposition) { 1921 TEST_F(RenderViewImplTest, SetEditableSelectionAndComposition) {
1917 // Load an HTML page consisting of an input field. 1922 // Load an HTML page consisting of an input field.
1918 LoadHTML("<html>" 1923 LoadHTML("<html>"
1919 "<head>" 1924 "<head>"
1920 "</head>" 1925 "</head>"
1921 "<body>" 1926 "<body>"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1956 EXPECT_EQ(7, info.selectionEnd); 1961 EXPECT_EQ(7, info.selectionEnd);
1957 SetEditableSelectionOffsets(4, 8); 1962 SetEditableSelectionOffsets(4, 8);
1958 ExtendSelectionAndDelete(2, 5); 1963 ExtendSelectionAndDelete(2, 5);
1959 info = view()->webview()->textInputInfo(); 1964 info = view()->webview()->textInputInfo();
1960 EXPECT_EQ("abuvwxyz", info.value); 1965 EXPECT_EQ("abuvwxyz", info.value);
1961 EXPECT_EQ(2, info.selectionStart); 1966 EXPECT_EQ(2, info.selectionStart);
1962 EXPECT_EQ(2, info.selectionEnd); 1967 EXPECT_EQ(2, info.selectionEnd);
1963 } 1968 }
1964 1969
1965 // Test that the navigating specific frames works correctly. 1970 // Test that the navigating specific frames works correctly.
1966 TEST_F(RenderViewImplTest, NavigateFrame) { 1971 TEST_F(RenderViewImplTest, NavigateSubframe) {
1967 // Load page A. 1972 // Load page A.
1968 LoadHTML("hello <iframe srcdoc='fail' name='frame'></iframe>"); 1973 LoadHTML("hello <iframe srcdoc='fail' name='frame'></iframe>");
1969 1974
1970 // Navigate the frame only. 1975 // Navigate the frame only.
1971 CommonNavigationParams common_params; 1976 CommonNavigationParams common_params;
1972 RequestNavigationParams request_params; 1977 RequestNavigationParams request_params;
1973 common_params.url = GURL("data:text/html,world"); 1978 common_params.url = GURL("data:text/html,world");
1974 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; 1979 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL;
1975 common_params.transition = ui::PAGE_TRANSITION_TYPED; 1980 common_params.transition = ui::PAGE_TRANSITION_TYPED;
1976 request_params.current_history_list_length = 1; 1981 request_params.current_history_list_length = 1;
1977 request_params.current_history_list_offset = 0; 1982 request_params.current_history_list_offset = 0;
1978 request_params.pending_history_list_offset = 1; 1983 request_params.pending_history_list_offset = 1;
1979 request_params.page_id = -1; 1984 request_params.page_id = -1;
1980 request_params.frame_to_navigate = "frame";
1981 request_params.browser_navigation_start = 1985 request_params.browser_navigation_start =
1982 base::TimeTicks::FromInternalValue(1); 1986 base::TimeTicks::FromInternalValue(1);
1983 NavigateFrame(common_params, StartNavigationParams(), request_params); 1987
1984 FrameLoadWaiter( 1988 RenderFrameImpl* subframe = RenderFrameImpl::FromWebFrame(
1985 RenderFrame::FromWebFrame(frame()->GetWebFrame()->firstChild())).Wait(); 1989 view()->webview()->findFrameByName("frame"));
1990 NavigateFrame(subframe, common_params, StartNavigationParams(),
1991 request_params);
1992 FrameLoadWaiter(subframe).Wait();
1986 1993
1987 // Copy the document content to std::wstring and compare with the 1994 // Copy the document content to std::wstring and compare with the
1988 // expected result. 1995 // expected result.
1989 const int kMaxOutputCharacters = 256; 1996 const int kMaxOutputCharacters = 256;
1990 std::string output = base::UTF16ToUTF8( 1997 std::string output = base::UTF16ToUTF8(
1991 GetMainFrame()->contentAsText(kMaxOutputCharacters)); 1998 GetMainFrame()->contentAsText(kMaxOutputCharacters));
1992 EXPECT_EQ(output, "hello \n\nworld"); 1999 EXPECT_EQ(output, "hello \n\nworld");
1993 } 2000 }
1994 2001
1995 // This test ensures that a RenderFrame object is created for the top level 2002 // This test ensures that a RenderFrame object is created for the top level
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
2090 error.domain = WebString::fromUTF8(net::kErrorDomain); 2097 error.domain = WebString::fromUTF8(net::kErrorDomain);
2091 error.reason = net::ERR_FILE_NOT_FOUND; 2098 error.reason = net::ERR_FILE_NOT_FOUND;
2092 error.unreachableURL = GURL("http://example.com/suppress"); 2099 error.unreachableURL = GURL("http://example.com/suppress");
2093 WebLocalFrame* web_frame = GetMainFrame(); 2100 WebLocalFrame* web_frame = GetMainFrame();
2094 2101
2095 // Start a load that will reach provisional state synchronously, 2102 // Start a load that will reach provisional state synchronously,
2096 // but won't complete synchronously. 2103 // but won't complete synchronously.
2097 CommonNavigationParams common_params; 2104 CommonNavigationParams common_params;
2098 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; 2105 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL;
2099 common_params.url = GURL("data:text/html,test data"); 2106 common_params.url = GURL("data:text/html,test data");
2100 NavigateFrame(common_params, StartNavigationParams(), 2107 NavigateMainFrame(common_params, StartNavigationParams(),
2101 RequestNavigationParams()); 2108 RequestNavigationParams());
2102 2109
2103 // An error occurred. 2110 // An error occurred.
2104 view()->GetMainRenderFrame()->didFailProvisionalLoad( 2111 view()->GetMainRenderFrame()->didFailProvisionalLoad(
2105 web_frame, error, blink::WebStandardCommit); 2112 web_frame, error, blink::WebStandardCommit);
2106 const int kMaxOutputCharacters = 22; 2113 const int kMaxOutputCharacters = 22;
2107 EXPECT_EQ("", 2114 EXPECT_EQ("",
2108 base::UTF16ToASCII(web_frame->contentAsText(kMaxOutputCharacters))); 2115 base::UTF16ToASCII(web_frame->contentAsText(kMaxOutputCharacters)));
2109 } 2116 }
2110 2117
2111 #if defined(OS_ANDROID) 2118 #if defined(OS_ANDROID)
2112 // Crashing on Android: http://crbug.com/311341 2119 // Crashing on Android: http://crbug.com/311341
2113 #define MAYBE_DoesNotSuppress DISABLED_DoesNotSuppress 2120 #define MAYBE_DoesNotSuppress DISABLED_DoesNotSuppress
2114 #else 2121 #else
2115 #define MAYBE_DoesNotSuppress DoesNotSuppress 2122 #define MAYBE_DoesNotSuppress DoesNotSuppress
2116 #endif 2123 #endif
2117 2124
2118 TEST_F(SuppressErrorPageTest, MAYBE_DoesNotSuppress) { 2125 TEST_F(SuppressErrorPageTest, MAYBE_DoesNotSuppress) {
2119 WebURLError error; 2126 WebURLError error;
2120 error.domain = WebString::fromUTF8(net::kErrorDomain); 2127 error.domain = WebString::fromUTF8(net::kErrorDomain);
2121 error.reason = net::ERR_FILE_NOT_FOUND; 2128 error.reason = net::ERR_FILE_NOT_FOUND;
2122 error.unreachableURL = GURL("http://example.com/dont-suppress"); 2129 error.unreachableURL = GURL("http://example.com/dont-suppress");
2123 WebLocalFrame* web_frame = GetMainFrame(); 2130 WebLocalFrame* web_frame = GetMainFrame();
2124 2131
2125 // Start a load that will reach provisional state synchronously, 2132 // Start a load that will reach provisional state synchronously,
2126 // but won't complete synchronously. 2133 // but won't complete synchronously.
2127 CommonNavigationParams common_params; 2134 CommonNavigationParams common_params;
2128 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; 2135 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL;
2129 common_params.url = GURL("data:text/html,test data"); 2136 common_params.url = GURL("data:text/html,test data");
2130 NavigateFrame(common_params, StartNavigationParams(), 2137 NavigateMainFrame(common_params, StartNavigationParams(),
2131 RequestNavigationParams()); 2138 RequestNavigationParams());
2132 2139
2133 // An error occurred. 2140 // An error occurred.
2134 view()->GetMainRenderFrame()->didFailProvisionalLoad( 2141 view()->GetMainRenderFrame()->didFailProvisionalLoad(
2135 web_frame, error, blink::WebStandardCommit); 2142 web_frame, error, blink::WebStandardCommit);
2136 // The error page itself is loaded asynchronously. 2143 // The error page itself is loaded asynchronously.
2137 FrameLoadWaiter(frame()).Wait(); 2144 FrameLoadWaiter(frame()).Wait();
2138 const int kMaxOutputCharacters = 22; 2145 const int kMaxOutputCharacters = 22;
2139 EXPECT_EQ("A suffusion of yellow.", 2146 EXPECT_EQ("A suffusion of yellow.",
2140 base::UTF16ToASCII(web_frame->contentAsText(kMaxOutputCharacters))); 2147 base::UTF16ToASCII(web_frame->contentAsText(kMaxOutputCharacters)));
2141 } 2148 }
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
2331 CommonNavigationParams early_common_params; 2338 CommonNavigationParams early_common_params;
2332 StartNavigationParams early_start_params; 2339 StartNavigationParams early_start_params;
2333 RequestNavigationParams early_request_params; 2340 RequestNavigationParams early_request_params;
2334 early_common_params.url = GURL("data:text/html,<div>Page</div>"); 2341 early_common_params.url = GURL("data:text/html,<div>Page</div>");
2335 early_common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; 2342 early_common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL;
2336 early_common_params.transition = ui::PAGE_TRANSITION_TYPED; 2343 early_common_params.transition = ui::PAGE_TRANSITION_TYPED;
2337 early_start_params.is_post = true; 2344 early_start_params.is_post = true;
2338 early_request_params.browser_navigation_start = 2345 early_request_params.browser_navigation_start =
2339 base::TimeTicks::FromInternalValue(1); 2346 base::TimeTicks::FromInternalValue(1);
2340 2347
2341 NavigateFrame(early_common_params, early_start_params, early_request_params); 2348 NavigateMainFrame(early_common_params, early_start_params,
2349 early_request_params);
2342 ProcessPendingMessages(); 2350 ProcessPendingMessages();
2343 2351
2344 base::Time early_nav_reported_start = 2352 base::Time early_nav_reported_start =
2345 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart()); 2353 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart());
2346 EXPECT_LT(early_nav_reported_start, before_navigation); 2354 EXPECT_LT(early_nav_reported_start, before_navigation);
2347 2355
2348 // Verify that a navigation that claims to have started in the future - 42 2356 // Verify that a navigation that claims to have started in the future - 42
2349 // days from now is *not* reported as one that starts in the future; as we 2357 // days from now is *not* reported as one that starts in the future; as we
2350 // sanitize the override allowing a maximum of ::Now(). 2358 // sanitize the override allowing a maximum of ::Now().
2351 CommonNavigationParams late_common_params; 2359 CommonNavigationParams late_common_params;
2352 RequestNavigationParams late_request_params; 2360 RequestNavigationParams late_request_params;
2353 StartNavigationParams late_start_params; 2361 StartNavigationParams late_start_params;
2354 late_common_params.url = GURL("data:text/html,<div>Another page</div>"); 2362 late_common_params.url = GURL("data:text/html,<div>Another page</div>");
2355 late_common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; 2363 late_common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL;
2356 late_common_params.transition = ui::PAGE_TRANSITION_TYPED; 2364 late_common_params.transition = ui::PAGE_TRANSITION_TYPED;
2357 late_start_params.is_post = true; 2365 late_start_params.is_post = true;
2358 late_request_params.browser_navigation_start = 2366 late_request_params.browser_navigation_start =
2359 base::TimeTicks::Now() + base::TimeDelta::FromDays(42); 2367 base::TimeTicks::Now() + base::TimeDelta::FromDays(42);
2360 2368
2361 NavigateFrame(late_common_params, late_start_params, late_request_params); 2369 NavigateMainFrame(late_common_params, late_start_params, late_request_params);
2362 ProcessPendingMessages(); 2370 ProcessPendingMessages();
2363 base::Time after_navigation = 2371 base::Time after_navigation =
2364 base::Time::Now() + base::TimeDelta::FromDays(1); 2372 base::Time::Now() + base::TimeDelta::FromDays(1);
2365 2373
2366 base::Time late_nav_reported_start = 2374 base::Time late_nav_reported_start =
2367 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart()); 2375 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart());
2368 EXPECT_LE(late_nav_reported_start, after_navigation); 2376 EXPECT_LE(late_nav_reported_start, after_navigation);
2369 } 2377 }
2370 2378
2371 TEST_F(RenderViewImplTest, PreferredSizeZoomed) { 2379 TEST_F(RenderViewImplTest, PreferredSizeZoomed) {
(...skipping 16 matching lines...) Expand all
2388 EXPECT_EQ(0, view()->historyBackListCount()); 2396 EXPECT_EQ(0, view()->historyBackListCount());
2389 EXPECT_EQ(0, view()->historyBackListCount() + 2397 EXPECT_EQ(0, view()->historyBackListCount() +
2390 view()->historyForwardListCount() + 1); 2398 view()->historyForwardListCount() + 1);
2391 2399
2392 // Receive a Navigate message with history parameters. 2400 // Receive a Navigate message with history parameters.
2393 RequestNavigationParams request_params; 2401 RequestNavigationParams request_params;
2394 request_params.current_history_list_length = 2; 2402 request_params.current_history_list_length = 2;
2395 request_params.current_history_list_offset = 1; 2403 request_params.current_history_list_offset = 1;
2396 request_params.pending_history_list_offset = 2; 2404 request_params.pending_history_list_offset = 2;
2397 request_params.page_id = -1; 2405 request_params.page_id = -1;
2398 NavigateFrame(CommonNavigationParams(), StartNavigationParams(), 2406 NavigateMainFrame(CommonNavigationParams(), StartNavigationParams(),
2399 request_params); 2407 request_params);
2400 2408
2401 // The history list in RenderView should have been updated. 2409 // The history list in RenderView should have been updated.
2402 EXPECT_EQ(1, view()->historyBackListCount()); 2410 EXPECT_EQ(1, view()->historyBackListCount());
2403 EXPECT_EQ(2, view()->historyBackListCount() + 2411 EXPECT_EQ(2, view()->historyBackListCount() +
2404 view()->historyForwardListCount() + 1); 2412 view()->historyForwardListCount() + 1);
2405 } 2413 }
2406 2414
2407 TEST_F(DevToolsAgentTest, DevToolsResumeOnClose) { 2415 TEST_F(DevToolsAgentTest, DevToolsResumeOnClose) {
2408 Attach(); 2416 Attach();
2409 EXPECT_FALSE(IsPaused()); 2417 EXPECT_FALSE(IsPaused());
2410 DispatchDevToolsMessage("{\"id\":1,\"method\":\"Debugger.enable\"}"); 2418 DispatchDevToolsMessage("{\"id\":1,\"method\":\"Debugger.enable\"}");
2411 2419
2412 // Executing javascript will pause the thread and create nested message loop. 2420 // Executing javascript will pause the thread and create nested message loop.
2413 // Posting task simulates message coming from browser. 2421 // Posting task simulates message coming from browser.
2414 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( 2422 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
2415 &DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); 2423 &DevToolsAgentTest::CloseWhilePaused, base::Unretained(this)));
2416 ExecuteJavaScript("debugger;"); 2424 ExecuteJavaScript("debugger;");
2417 2425
2418 // CloseWhilePaused should resume execution and continue here. 2426 // CloseWhilePaused should resume execution and continue here.
2419 EXPECT_FALSE(IsPaused()); 2427 EXPECT_FALSE(IsPaused());
2420 Detach(); 2428 Detach();
2421 } 2429 }
2422 2430
2423 } // namespace content 2431 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | content/renderer/render_view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698