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

Side by Side Diff: content/browser/web_contents/render_view_host_manager_unittest.cc

Issue 14985014: Introduce content::PageState (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compilation issues. Created 7 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 | Annotate | Revision Log
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/utf_string_conversions.h" 5 #include "base/utf_string_conversions.h"
6 #include "content/browser/browser_thread_impl.h" 6 #include "content/browser/browser_thread_impl.h"
7 #include "content/browser/renderer_host/test_render_view_host.h" 7 #include "content/browser/renderer_host/test_render_view_host.h"
8 #include "content/browser/site_instance_impl.h" 8 #include "content/browser/site_instance_impl.h"
9 #include "content/browser/web_contents/navigation_controller_impl.h" 9 #include "content/browser/web_contents/navigation_controller_impl.h"
10 #include "content/browser/web_contents/navigation_entry_impl.h" 10 #include "content/browser/web_contents/navigation_entry_impl.h"
11 #include "content/browser/web_contents/render_view_host_manager.h" 11 #include "content/browser/web_contents/render_view_host_manager.h"
12 #include "content/browser/webui/web_ui_controller_factory_registry.h" 12 #include "content/browser/webui/web_ui_controller_factory_registry.h"
13 #include "content/common/view_messages.h" 13 #include "content/common/view_messages.h"
14 #include "content/public/browser/notification_details.h" 14 #include "content/public/browser/notification_details.h"
15 #include "content/public/browser/notification_source.h" 15 #include "content/public/browser/notification_source.h"
16 #include "content/public/browser/notification_types.h" 16 #include "content/public/browser/notification_types.h"
17 #include "content/public/browser/web_ui_controller.h" 17 #include "content/public/browser/web_ui_controller.h"
18 #include "content/public/common/bindings_policy.h" 18 #include "content/public/common/bindings_policy.h"
19 #include "content/public/common/javascript_message_type.h" 19 #include "content/public/common/javascript_message_type.h"
20 #include "content/public/common/page_transition_types.h" 20 #include "content/public/common/page_transition_types.h"
21 #include "content/public/common/url_constants.h" 21 #include "content/public/common/url_constants.h"
22 #include "content/public/test/mock_render_process_host.h" 22 #include "content/public/test/mock_render_process_host.h"
23 #include "content/public/test/test_browser_context.h" 23 #include "content/public/test/test_browser_context.h"
24 #include "content/public/test/test_notification_tracker.h" 24 #include "content/public/test/test_notification_tracker.h"
25 #include "content/test/test_content_browser_client.h" 25 #include "content/test/test_content_browser_client.h"
26 #include "content/test/test_content_client.h" 26 #include "content/test/test_content_client.h"
27 #include "content/test/test_web_contents.h" 27 #include "content/test/test_web_contents.h"
28 #include "testing/gtest/include/gtest/gtest.h" 28 #include "testing/gtest/include/gtest/gtest.h"
29 #include "webkit/glue/glue_serialize.h"
30 29
31 namespace content { 30 namespace content {
32 namespace { 31 namespace {
33 32
34 class RenderViewHostManagerTestWebUIControllerFactory 33 class RenderViewHostManagerTestWebUIControllerFactory
35 : public WebUIControllerFactory { 34 : public WebUIControllerFactory {
36 public: 35 public:
37 RenderViewHostManagerTestWebUIControllerFactory() 36 RenderViewHostManagerTestWebUIControllerFactory()
38 : should_create_webui_(false) { 37 : should_create_webui_(false) {
39 } 38 }
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 717
719 // Before that RVH has committed, the evil page reloads itself. 718 // Before that RVH has committed, the evil page reloads itself.
720 ViewHostMsg_FrameNavigate_Params params; 719 ViewHostMsg_FrameNavigate_Params params;
721 params.page_id = 1; 720 params.page_id = 1;
722 params.url = kUrl2; 721 params.url = kUrl2;
723 params.transition = PAGE_TRANSITION_CLIENT_REDIRECT; 722 params.transition = PAGE_TRANSITION_CLIENT_REDIRECT;
724 params.should_update_history = false; 723 params.should_update_history = false;
725 params.gesture = NavigationGestureAuto; 724 params.gesture = NavigationGestureAuto;
726 params.was_within_same_page = false; 725 params.was_within_same_page = false;
727 params.is_post = false; 726 params.is_post = false;
728 params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(kUrl2)); 727 params.page_state = PageState::CreateFromURL(kUrl2);
729 contents()->DidNavigate(evil_rvh, params); 728 contents()->DidNavigate(evil_rvh, params);
730 729
731 // That should have cancelled the pending RVH, and the evil RVH should be the 730 // That should have cancelled the pending RVH, and the evil RVH should be the
732 // current one. 731 // current one.
733 EXPECT_TRUE(contents()->GetRenderManagerForTesting()-> 732 EXPECT_TRUE(contents()->GetRenderManagerForTesting()->
734 pending_render_view_host() == NULL); 733 pending_render_view_host() == NULL);
735 EXPECT_EQ(evil_rvh, contents()->GetRenderManagerForTesting()->current_host()); 734 EXPECT_EQ(evil_rvh, contents()->GetRenderManagerForTesting()->current_host());
736 735
737 // Also we should not have a pending navigation entry. 736 // Also we should not have a pending navigation entry.
738 NavigationEntry* entry = contents()->GetController().GetActiveEntry(); 737 NavigationEntry* entry = contents()->GetController().GetActiveEntry();
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 941
943 // Commit. 942 // Commit.
944 manager.DidNavigateMainFrame(host); 943 manager.DidNavigateMainFrame(host);
945 EXPECT_EQ(host, manager.current_host()); 944 EXPECT_EQ(host, manager.current_host());
946 ASSERT_TRUE(host); 945 ASSERT_TRUE(host);
947 EXPECT_EQ(static_cast<SiteInstanceImpl*>(host->GetSiteInstance()), 946 EXPECT_EQ(static_cast<SiteInstanceImpl*>(host->GetSiteInstance()),
948 instance); 947 instance);
949 } 948 }
950 949
951 } // namespace content 950 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698