OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 4157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4168 controller.ClearAllScreenshots(); | 4168 controller.ClearAllScreenshots(); |
4169 EXPECT_EQ(0, screenshot_manager->GetScreenshotCount()); | 4169 EXPECT_EQ(0, screenshot_manager->GetScreenshotCount()); |
4170 for (int i = 0; i < controller.GetEntryCount(); ++i) { | 4170 for (int i = 0; i < controller.GetEntryCount(); ++i) { |
4171 entry = NavigationEntryImpl::FromNavigationEntry( | 4171 entry = NavigationEntryImpl::FromNavigationEntry( |
4172 controller.GetEntryAtIndex(i)); | 4172 controller.GetEntryAtIndex(i)); |
4173 EXPECT_FALSE(entry->screenshot().get()) << "Screenshot " << i | 4173 EXPECT_FALSE(entry->screenshot().get()) << "Screenshot " << i |
4174 << " not cleared"; | 4174 << " not cleared"; |
4175 } | 4175 } |
4176 } | 4176 } |
4177 | 4177 |
| 4178 TEST_F(NavigationControllerTest, PushStateUpdatesTitle) { |
| 4179 |
| 4180 // Navigate |
| 4181 test_rvh()->SendNavigate(1, GURL("http://foo")); |
| 4182 |
| 4183 // Set title |
| 4184 base::string16 title(base::ASCIIToUTF16("Title")); |
| 4185 controller().GetLastCommittedEntry()->SetTitle(title); |
| 4186 |
| 4187 // history.pushState() is called. |
| 4188 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
| 4189 GURL url("http://foo#foo"); |
| 4190 params.page_id = 2; |
| 4191 params.url = url; |
| 4192 params.page_state = PageState::CreateFromURL(url); |
| 4193 params.was_within_same_page = true; |
| 4194 test_rvh()->SendNavigateWithParams(¶ms); |
| 4195 |
| 4196 // The title should immediately be visible on the new NavigationEntry. |
| 4197 base::string16 new_title = |
| 4198 controller().GetLastCommittedEntry()->GetTitleForDisplay(std::string()); |
| 4199 EXPECT_EQ(title, new_title); |
| 4200 } |
| 4201 |
4178 // Test that the navigation controller clears its session history when a | 4202 // Test that the navigation controller clears its session history when a |
4179 // navigation commits with the clear history list flag set. | 4203 // navigation commits with the clear history list flag set. |
4180 TEST_F(NavigationControllerTest, ClearHistoryList) { | 4204 TEST_F(NavigationControllerTest, ClearHistoryList) { |
4181 const GURL url1("http://foo1"); | 4205 const GURL url1("http://foo1"); |
4182 const GURL url2("http://foo2"); | 4206 const GURL url2("http://foo2"); |
4183 const GURL url3("http://foo3"); | 4207 const GURL url3("http://foo3"); |
4184 const GURL url4("http://foo4"); | 4208 const GURL url4("http://foo4"); |
4185 | 4209 |
4186 NavigationControllerImpl& controller = controller_impl(); | 4210 NavigationControllerImpl& controller = controller_impl(); |
4187 | 4211 |
(...skipping 30 matching lines...) Expand all Loading... |
4218 EXPECT_EQ(1, controller.GetEntryCount()); | 4242 EXPECT_EQ(1, controller.GetEntryCount()); |
4219 EXPECT_EQ(0, controller.GetCurrentEntryIndex()); | 4243 EXPECT_EQ(0, controller.GetCurrentEntryIndex()); |
4220 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); | 4244 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); |
4221 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); | 4245 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); |
4222 EXPECT_FALSE(controller.CanGoBack()); | 4246 EXPECT_FALSE(controller.CanGoBack()); |
4223 EXPECT_FALSE(controller.CanGoForward()); | 4247 EXPECT_FALSE(controller.CanGoForward()); |
4224 EXPECT_EQ(url4, controller.GetVisibleEntry()->GetURL()); | 4248 EXPECT_EQ(url4, controller.GetVisibleEntry()->GetURL()); |
4225 } | 4249 } |
4226 | 4250 |
4227 } // namespace content | 4251 } // namespace content |
OLD | NEW |