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/test/base/chrome_render_view_host_test_harness.h" | 5 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
6 #include "chrome/test/base/testing_profile.h" | 6 #include "chrome/test/base/testing_profile.h" |
7 #include "content/browser/browser_url_handler.h" | 7 #include "content/browser/browser_url_handler.h" |
8 #include "content/browser/site_instance.h" | 8 #include "content/browser/site_instance.h" |
9 #include "content/browser/tab_contents/navigation_controller.h" | 9 #include "content/browser/tab_contents/navigation_controller.h" |
10 #include "content/browser/tab_contents/navigation_entry.h" | 10 #include "content/browser/tab_contents/navigation_entry.h" |
11 #include "content/browser/tab_contents/render_view_host_manager.h" | 11 #include "content/browser/tab_contents/render_view_host_manager.h" |
12 #include "content/browser/tab_contents/test_tab_contents.h" | 12 #include "content/browser/tab_contents/test_tab_contents.h" |
13 #include "content/common/test_url_constants.h" | 13 #include "content/common/test_url_constants.h" |
14 #include "content/common/view_messages.h" | 14 #include "content/common/view_messages.h" |
15 #include "content/public/browser/notification_details.h" | 15 #include "content/public/browser/notification_details.h" |
16 #include "content/public/browser/notification_source.h" | 16 #include "content/public/browser/notification_source.h" |
17 #include "content/public/browser/notification_types.h" | 17 #include "content/public/browser/notification_types.h" |
18 #include "content/public/common/page_transition_types.h" | 18 #include "content/public/common/page_transition_types.h" |
19 #include "content/test/test_browser_thread.h" | 19 #include "content/test/test_browser_thread.h" |
20 #include "content/test/test_browser_thread.h" | 20 #include "content/test/test_browser_thread.h" |
21 #include "content/test/test_notification_tracker.h" | 21 #include "content/test/test_notification_tracker.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
23 #include "webkit/glue/webkit_glue.h" | 23 #include "webkit/glue/webkit_glue.h" |
24 | 24 |
| 25 using content::BrowserThread; |
| 26 |
25 class RenderViewHostManagerTest : public ChromeRenderViewHostTestHarness { | 27 class RenderViewHostManagerTest : public ChromeRenderViewHostTestHarness { |
26 public: | 28 public: |
27 void NavigateActiveAndCommit(const GURL& url) { | 29 void NavigateActiveAndCommit(const GURL& url) { |
28 // Note: we navigate the active RenderViewHost because previous navigations | 30 // Note: we navigate the active RenderViewHost because previous navigations |
29 // won't have committed yet, so NavigateAndCommit does the wrong thing | 31 // won't have committed yet, so NavigateAndCommit does the wrong thing |
30 // for us. | 32 // for us. |
31 controller().LoadURL( | 33 controller().LoadURL( |
32 url, GURL(), content::PAGE_TRANSITION_LINK, std::string()); | 34 url, GURL(), content::PAGE_TRANSITION_LINK, std::string()); |
33 TestRenderViewHost* old_rvh = rvh(); | 35 TestRenderViewHost* old_rvh = rvh(); |
34 | 36 |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 // current one. | 382 // current one. |
381 EXPECT_TRUE(contents()->render_manager_for_testing()-> | 383 EXPECT_TRUE(contents()->render_manager_for_testing()-> |
382 pending_render_view_host() == NULL); | 384 pending_render_view_host() == NULL); |
383 EXPECT_EQ(evil_rvh, contents()->render_manager_for_testing()->current_host()); | 385 EXPECT_EQ(evil_rvh, contents()->render_manager_for_testing()->current_host()); |
384 | 386 |
385 // Also we should not have a pending navigation entry. | 387 // Also we should not have a pending navigation entry. |
386 NavigationEntry* entry = contents()->controller().GetActiveEntry(); | 388 NavigationEntry* entry = contents()->controller().GetActiveEntry(); |
387 ASSERT_TRUE(entry != NULL); | 389 ASSERT_TRUE(entry != NULL); |
388 EXPECT_EQ(kUrl2, entry->url()); | 390 EXPECT_EQ(kUrl2, entry->url()); |
389 } | 391 } |
OLD | NEW |