| OLD | NEW |
| 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/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 1867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1878 { | 1878 { |
| 1879 const GURL url("http://foo/"); | 1879 const GURL url("http://foo/"); |
| 1880 test_rvh()->SendNavigate(0, url); | 1880 test_rvh()->SendNavigate(0, url); |
| 1881 EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); | 1881 EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); |
| 1882 } | 1882 } |
| 1883 | 1883 |
| 1884 // Navigate to a new page. | 1884 // Navigate to a new page. |
| 1885 { | 1885 { |
| 1886 const GURL url("http://foo2/"); | 1886 const GURL url("http://foo2/"); |
| 1887 test_rvh()->SendNavigate(1, url); | 1887 test_rvh()->SendNavigate(1, url); |
| 1888 controller.DocumentLoadedInFrame(); | |
| 1889 EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); | 1888 EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); |
| 1890 } | 1889 } |
| 1891 | 1890 |
| 1892 // Navigate within the page. | 1891 // Navigate within the page. |
| 1893 { | 1892 { |
| 1894 const GURL url("http://foo2/#a"); | 1893 const GURL url("http://foo2/#a"); |
| 1895 ViewHostMsg_FrameNavigate_Params params; | 1894 ViewHostMsg_FrameNavigate_Params params; |
| 1896 params.page_id = 1; // Same page_id | 1895 params.page_id = 1; // Same page_id |
| 1897 params.url = url; | 1896 params.url = url; |
| 1898 params.transition = PAGE_TRANSITION_LINK; | 1897 params.transition = PAGE_TRANSITION_LINK; |
| (...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3047 } | 3046 } |
| 3048 | 3047 |
| 3049 TEST_F(NavigationControllerTest, IsInitialNavigation) { | 3048 TEST_F(NavigationControllerTest, IsInitialNavigation) { |
| 3050 NavigationControllerImpl& controller = controller_impl(); | 3049 NavigationControllerImpl& controller = controller_impl(); |
| 3051 TestNotificationTracker notifications; | 3050 TestNotificationTracker notifications; |
| 3052 RegisterForAllNavNotifications(¬ifications, &controller); | 3051 RegisterForAllNavNotifications(¬ifications, &controller); |
| 3053 | 3052 |
| 3054 // Initial state. | 3053 // Initial state. |
| 3055 EXPECT_TRUE(controller.IsInitialNavigation()); | 3054 EXPECT_TRUE(controller.IsInitialNavigation()); |
| 3056 | 3055 |
| 3057 // After load, it is false. | 3056 // After commit, it stays false. |
| 3058 controller.DocumentLoadedInFrame(); | |
| 3059 EXPECT_FALSE(controller.IsInitialNavigation()); | |
| 3060 | |
| 3061 const GURL url1("http://foo1"); | 3057 const GURL url1("http://foo1"); |
| 3062 test_rvh()->SendNavigate(0, url1); | 3058 test_rvh()->SendNavigate(0, url1); |
| 3063 EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); | 3059 EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); |
| 3060 EXPECT_FALSE(controller.IsInitialNavigation()); |
| 3064 | 3061 |
| 3065 // After commit, it stays false. | 3062 // After starting a new navigation, it stays false. |
| 3066 EXPECT_FALSE(controller.IsInitialNavigation()); | 3063 const GURL url2("http://foo2"); |
| 3064 controller.LoadURL( |
| 3065 url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); |
| 3067 } | 3066 } |
| 3068 | 3067 |
| 3069 // Check that the favicon is not reused across a client redirect. | 3068 // Check that the favicon is not reused across a client redirect. |
| 3070 // (crbug.com/28515) | 3069 // (crbug.com/28515) |
| 3071 TEST_F(NavigationControllerTest, ClearFaviconOnRedirect) { | 3070 TEST_F(NavigationControllerTest, ClearFaviconOnRedirect) { |
| 3072 const GURL kPageWithFavicon("http://withfavicon.html"); | 3071 const GURL kPageWithFavicon("http://withfavicon.html"); |
| 3073 const GURL kPageWithoutFavicon("http://withoutfavicon.html"); | 3072 const GURL kPageWithoutFavicon("http://withoutfavicon.html"); |
| 3074 const GURL kIconURL("http://withfavicon.ico"); | 3073 const GURL kIconURL("http://withfavicon.ico"); |
| 3075 const gfx::Image kDefaultFavicon = FaviconStatus().image; | 3074 const gfx::Image kDefaultFavicon = FaviconStatus().image; |
| 3076 | 3075 |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3412 PAGE_TRANSITION_LINK); | 3411 PAGE_TRANSITION_LINK); |
| 3413 session_helper_.AssertNavigationEquals(nav, | 3412 session_helper_.AssertNavigationEquals(nav, |
| 3414 windows_[0]->tabs[0]->navigations[0]); | 3413 windows_[0]->tabs[0]->navigations[0]); |
| 3415 nav.set_url(url2); | 3414 nav.set_url(url2); |
| 3416 session_helper_.AssertNavigationEquals(nav, | 3415 session_helper_.AssertNavigationEquals(nav, |
| 3417 windows_[0]->tabs[0]->navigations[1]); | 3416 windows_[0]->tabs[0]->navigations[1]); |
| 3418 } | 3417 } |
| 3419 */ | 3418 */ |
| 3420 | 3419 |
| 3421 } // namespace content | 3420 } // namespace content |
| OLD | NEW |