OLD | NEW |
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 "chrome/browser/browser_thread.h" | 5 #include "chrome/browser/browser_thread.h" |
6 #include "chrome/browser/browser_url_handler.h" | 6 #include "chrome/browser/browser_url_handler.h" |
7 #include "chrome/browser/renderer_host/site_instance.h" | |
8 #include "chrome/browser/renderer_host/test/test_render_view_host.h" | |
9 #include "chrome/browser/tab_contents/navigation_controller.h" | |
10 #include "chrome/browser/tab_contents/navigation_entry.h" | |
11 #include "chrome/browser/tab_contents/render_view_host_manager.h" | |
12 #include "chrome/browser/tab_contents/test_tab_contents.h" | |
13 #include "chrome/common/notification_details.h" | 7 #include "chrome/common/notification_details.h" |
14 #include "chrome/common/notification_source.h" | 8 #include "chrome/common/notification_source.h" |
15 #include "chrome/common/page_transition_types.h" | 9 #include "chrome/common/page_transition_types.h" |
16 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
17 #include "chrome/common/render_messages_params.h" | 11 #include "chrome/common/render_messages_params.h" |
18 #include "chrome/common/url_constants.h" | 12 #include "chrome/common/url_constants.h" |
19 #include "chrome/test/test_notification_tracker.h" | 13 #include "chrome/test/test_notification_tracker.h" |
20 #include "chrome/test/testing_profile.h" | 14 #include "chrome/test/testing_profile.h" |
| 15 #include "content/browser/renderer_host/test_render_view_host.h" |
| 16 #include "content/browser/site_instance.h" |
| 17 #include "content/browser/tab_contents/navigation_controller.h" |
| 18 #include "content/browser/tab_contents/navigation_entry.h" |
| 19 #include "content/browser/tab_contents/render_view_host_manager.h" |
| 20 #include "content/browser/tab_contents/test_tab_contents.h" |
21 #include "ipc/ipc_message.h" | 21 #include "ipc/ipc_message.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
23 | 23 |
24 class RenderViewHostManagerTest : public RenderViewHostTestHarness { | 24 class RenderViewHostManagerTest : public RenderViewHostTestHarness { |
25 public: | 25 public: |
26 void NavigateActiveAndCommit(const GURL& url) { | 26 void NavigateActiveAndCommit(const GURL& url) { |
27 // Note: we navigate the active RenderViewHost because previous navigations | 27 // Note: we navigate the active RenderViewHost because previous navigations |
28 // won't have committed yet, so NavigateAndCommit does the wrong thing | 28 // won't have committed yet, so NavigateAndCommit does the wrong thing |
29 // for us. | 29 // for us. |
30 controller().LoadURL(url, GURL(), PageTransition::LINK); | 30 controller().LoadURL(url, GURL(), PageTransition::LINK); |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 // That should have cancelled the pending RVH, and the evil RVH should be the | 336 // That should have cancelled the pending RVH, and the evil RVH should be the |
337 // current one. | 337 // current one. |
338 EXPECT_TRUE(contents()->render_manager()->pending_render_view_host() == NULL); | 338 EXPECT_TRUE(contents()->render_manager()->pending_render_view_host() == NULL); |
339 EXPECT_EQ(evil_rvh, contents()->render_manager()->current_host()); | 339 EXPECT_EQ(evil_rvh, contents()->render_manager()->current_host()); |
340 | 340 |
341 // Also we should not have a pending navigation entry. | 341 // Also we should not have a pending navigation entry. |
342 NavigationEntry* entry = contents()->controller().GetActiveEntry(); | 342 NavigationEntry* entry = contents()->controller().GetActiveEntry(); |
343 ASSERT_TRUE(entry != NULL); | 343 ASSERT_TRUE(entry != NULL); |
344 EXPECT_EQ(url2, entry->url()); | 344 EXPECT_EQ(url2, entry->url()); |
345 } | 345 } |
OLD | NEW |