| 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/site_instance.h" | 11 #include "content/browser/site_instance.h" |
| 12 #include "content/browser/tab_contents/navigation_controller.h" | 12 #include "content/browser/tab_contents/navigation_controller.h" |
| 13 #include "content/browser/tab_contents/test_tab_contents.h" | 13 #include "content/browser/tab_contents/test_tab_contents.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; |
| 18 |
| 17 class WebUITest : public TabContentsWrapperTestHarness { | 19 class WebUITest : public TabContentsWrapperTestHarness { |
| 18 public: | 20 public: |
| 19 WebUITest() : ui_thread_(BrowserThread::UI, MessageLoop::current()) {} | 21 WebUITest() : ui_thread_(BrowserThread::UI, MessageLoop::current()) {} |
| 20 | 22 |
| 21 // Tests navigating with a Web UI from a fresh (nothing pending or committed) | 23 // Tests navigating with a Web UI from a fresh (nothing pending or committed) |
| 22 // state, through pending, committed, then another navigation. The first page | 24 // state, through pending, committed, then another navigation. The first page |
| 23 // ID that we should use is passed as a parameter. We'll use the next two | 25 // ID that we should use is passed as a parameter. We'll use the next two |
| 24 // values. This must be increasing for the life of the tests. | 26 // values. This must be increasing for the life of the tests. |
| 25 static void DoNavigationTest(TabContentsWrapper* wrapper, int page_id) { | 27 static void DoNavigationTest(TabContentsWrapper* wrapper, int page_id) { |
| 26 TabContents* contents = wrapper->tab_contents(); | 28 TabContents* contents = wrapper->tab_contents(); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 // Navigate forward. Shouldn't focus the location bar. | 196 // Navigate forward. Shouldn't focus the location bar. |
| 195 focus_called = tc->focus_called(); | 197 focus_called = tc->focus_called(); |
| 196 ASSERT_TRUE(controller().CanGoForward()); | 198 ASSERT_TRUE(controller().CanGoForward()); |
| 197 controller().GoForward(); | 199 controller().GoForward(); |
| 198 old_rvh = rvh(); | 200 old_rvh = rvh(); |
| 199 old_rvh->SendShouldCloseACK(true); | 201 old_rvh->SendShouldCloseACK(true); |
| 200 pending_rvh()->SendNavigate(next_page_id, next_url); | 202 pending_rvh()->SendNavigate(next_page_id, next_url); |
| 201 old_rvh->OnSwapOutACK(); | 203 old_rvh->OnSwapOutACK(); |
| 202 EXPECT_EQ(focus_called, tc->focus_called()); | 204 EXPECT_EQ(focus_called, tc->focus_called()); |
| 203 } | 205 } |
| OLD | NEW |