OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/frame_host/navigation_controller_impl.h" | 5 #include "content/browser/frame_host/navigation_controller_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 same_tab_observer.Wait(); | 196 same_tab_observer.Wait(); |
197 EXPECT_EQ(2, controller.GetEntryCount()); | 197 EXPECT_EQ(2, controller.GetEntryCount()); |
198 NavigationEntryImpl* entry = controller.GetLastCommittedEntry(); | 198 NavigationEntryImpl* entry = controller.GetLastCommittedEntry(); |
199 EXPECT_TRUE(entry->GetBaseURLForDataURL().is_empty()); | 199 EXPECT_TRUE(entry->GetBaseURLForDataURL().is_empty()); |
200 EXPECT_TRUE(entry->GetHistoryURLForDataURL().is_empty()); | 200 EXPECT_TRUE(entry->GetHistoryURLForDataURL().is_empty()); |
201 EXPECT_EQ(navigate_url, entry->GetVirtualURL()); | 201 EXPECT_EQ(navigate_url, entry->GetVirtualURL()); |
202 EXPECT_EQ(navigate_url, entry->GetURL()); | 202 EXPECT_EQ(navigate_url, entry->GetURL()); |
203 } | 203 } |
204 } | 204 } |
205 | 205 |
206 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, | |
207 FragmentNavigateFromLoadDataWithBaseURL) { | |
208 const GURL base_url("http://baseurl"); | |
209 const GURL history_url("http://historyurl"); | |
210 const std::string data = | |
211 "<html><body>" | |
212 " <p id=\"frag\"><a id=\"fraglink\" href=\"#frag\">in-page nav</a></p>" | |
213 "</body></html>"; | |
214 | |
215 const NavigationControllerImpl& controller = | |
216 static_cast<const NavigationControllerImpl&>( | |
217 shell()->web_contents()->GetController()); | |
218 | |
219 // Load data and commit. | |
220 TestNavigationObserver same_tab_observer(shell()->web_contents(), 1); | |
221 #if defined(OS_ANDROID) | |
222 shell()->LoadDataAsStringWithBaseURL(history_url, data, base_url); | |
223 #else | |
224 shell()->LoadDataWithBaseURL(history_url, data, base_url); | |
225 #endif | |
226 same_tab_observer.Wait(); | |
227 EXPECT_EQ(1, controller.GetEntryCount()); | |
228 | |
229 // Performance a fragment navigation using a javascript: URL. | |
Charlie Reis
2016/03/16 19:30:34
Perform?
| |
230 GURL js_url("javascript:document.location = '#frag';"); | |
231 NavigateToURL(shell(), js_url); | |
232 EXPECT_EQ(2, controller.GetEntryCount()); | |
Charlie Reis
2016/03/16 19:30:34
Please add some expectations about what the variou
boliu
2016/03/16 20:18:21
On trunk these values are
Base url: empty
virtual
boliu
2016/03/16 20:26:07
I uploaded PS3 with all the other comments address
boliu
2016/03/16 20:38:32
Err, wait, these are just the expectations for a j
| |
233 | |
234 // Passes if renderer is still alive. | |
235 EXPECT_TRUE( | |
236 ExecuteScript(shell()->web_contents(), "console.log('Success');")); | |
237 } | |
238 | |
206 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, UniqueIDs) { | 239 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, UniqueIDs) { |
207 const NavigationControllerImpl& controller = | 240 const NavigationControllerImpl& controller = |
208 static_cast<const NavigationControllerImpl&>( | 241 static_cast<const NavigationControllerImpl&>( |
209 shell()->web_contents()->GetController()); | 242 shell()->web_contents()->GetController()); |
210 | 243 |
211 GURL main_url(embedded_test_server()->GetURL( | 244 GURL main_url(embedded_test_server()->GetURL( |
212 "/navigation_controller/page_with_link_to_load_iframe.html")); | 245 "/navigation_controller/page_with_link_to_load_iframe.html")); |
213 NavigateToURL(shell(), main_url); | 246 NavigateToURL(shell(), main_url); |
214 ASSERT_EQ(1, controller.GetEntryCount()); | 247 ASSERT_EQ(1, controller.GetEntryCount()); |
215 | 248 |
(...skipping 3185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3401 observer.Wait(); | 3434 observer.Wait(); |
3402 | 3435 |
3403 EXPECT_EQ(3, controller.GetEntryCount()); | 3436 EXPECT_EQ(3, controller.GetEntryCount()); |
3404 EXPECT_EQ(3, RendererHistoryLength(shell())); | 3437 EXPECT_EQ(3, RendererHistoryLength(shell())); |
3405 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); | 3438 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); |
3406 | 3439 |
3407 EXPECT_EQ(frame_url_1, frame->current_url()); | 3440 EXPECT_EQ(frame_url_1, frame->current_url()); |
3408 } | 3441 } |
3409 | 3442 |
3410 } // namespace content | 3443 } // namespace content |
OLD | NEW |