| 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/favicon/favicon_tab_helper.h" | 5 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 6 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 6 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| 7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 8 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" | 8 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" |
| 9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
| 10 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
| 11 #include "content/browser/tab_contents/test_tab_contents.h" | 11 #include "content/browser/tab_contents/test_tab_contents.h" |
| 12 #include "content/public/browser/navigation_controller.h" | 12 #include "content/public/browser/navigation_controller.h" |
| 13 #include "content/public/browser/site_instance.h" | 13 #include "content/public/browser/site_instance.h" |
| 14 #include "content/test/test_browser_thread.h" | 14 #include "content/test/test_browser_thread.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 16 |
| 17 using content::BrowserThread; | 17 using content::BrowserThread; |
| 18 using content::NavigationController; | 18 using content::NavigationController; |
| 19 using content::SiteInstance; | 19 using content::SiteInstance; |
| 20 using content::TestRenderViewHost; |
| 20 using content::WebContents; | 21 using content::WebContents; |
| 21 | 22 |
| 22 class WebUITest : public TabContentsWrapperTestHarness { | 23 class WebUITest : public TabContentsWrapperTestHarness { |
| 23 public: | 24 public: |
| 24 WebUITest() : ui_thread_(BrowserThread::UI, MessageLoop::current()) {} | 25 WebUITest() : ui_thread_(BrowserThread::UI, MessageLoop::current()) {} |
| 25 | 26 |
| 26 // Tests navigating with a Web UI from a fresh (nothing pending or committed) | 27 // Tests navigating with a Web UI from a fresh (nothing pending or committed) |
| 27 // state, through pending, committed, then another navigation. The first page | 28 // state, through pending, committed, then another navigation. The first page |
| 28 // ID that we should use is passed as a parameter. We'll use the next two | 29 // ID that we should use is passed as a parameter. We'll use the next two |
| 29 // values. This must be increasing for the life of the tests. | 30 // values. This must be increasing for the life of the tests. |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 // Navigate forward. Shouldn't focus the location bar. | 208 // Navigate forward. Shouldn't focus the location bar. |
| 208 focus_called = tc->focus_called(); | 209 focus_called = tc->focus_called(); |
| 209 ASSERT_TRUE(controller().CanGoForward()); | 210 ASSERT_TRUE(controller().CanGoForward()); |
| 210 controller().GoForward(); | 211 controller().GoForward(); |
| 211 old_rvh = rvh(); | 212 old_rvh = rvh(); |
| 212 old_rvh->SendShouldCloseACK(true); | 213 old_rvh->SendShouldCloseACK(true); |
| 213 pending_rvh()->SendNavigate(next_page_id, next_url); | 214 pending_rvh()->SendNavigate(next_page_id, next_url); |
| 214 old_rvh->OnSwapOutACK(); | 215 old_rvh->OnSwapOutACK(); |
| 215 EXPECT_EQ(focus_called, tc->focus_called()); | 216 EXPECT_EQ(focus_called, tc->focus_called()); |
| 216 } | 217 } |
| OLD | NEW |