Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: content/browser/frame_host/navigation_controller_impl_browsertest.cc

Issue 1449793002: data_with_base_url (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix tests Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/strings/stringprintf.h" 6 #include "base/strings/stringprintf.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "content/browser/frame_host/frame_navigation_entry.h" 8 #include "content/browser/frame_host/frame_navigation_entry.h"
9 #include "content/browser/frame_host/frame_tree.h" 9 #include "content/browser/frame_host/frame_tree.h"
10 #include "content/browser/frame_host/navigation_controller_impl.h" 10 #include "content/browser/frame_host/navigation_controller_impl.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // We should only have swapped processes in --site-per-process. 63 // We should only have swapped processes in --site-per-process.
64 bool cross_process = root->current_frame_host()->GetProcess() != 64 bool cross_process = root->current_frame_host()->GetProcess() !=
65 root->child_at(0)->current_frame_host()->GetProcess(); 65 root->child_at(0)->current_frame_host()->GetProcess();
66 EXPECT_EQ(AreAllSitesIsolatedForTesting(), cross_process); 66 EXPECT_EQ(AreAllSitesIsolatedForTesting(), cross_process);
67 } 67 }
68 68
69 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, LoadDataWithBaseURL) { 69 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, LoadDataWithBaseURL) {
70 const GURL base_url("http://baseurl"); 70 const GURL base_url("http://baseurl");
71 const GURL history_url("http://historyurl"); 71 const GURL history_url("http://historyurl");
72 const std::string data = "<html><body>foo</body></html>"; 72 const std::string data = "<html><body>foo</body></html>";
73
74 const NavigationController& controller =
75 shell()->web_contents()->GetController();
76 // Load data. Blocks until it is done.
77 content::LoadDataWithBaseURL(shell(), history_url, data, base_url); 73 content::LoadDataWithBaseURL(shell(), history_url, data, base_url);
78 74 ReloadBlockUntilNavigationsComplete(shell(), 1);
79 // We should use history_url instead of the base_url as the original url of 75 EXPECT_TRUE(
80 // this navigation entry, because base_url is only used for resolving relative 76 ExecuteScript(shell()->web_contents(), "console.log('Success');"));
81 // paths in the data, or enforcing same origin policy.
82 EXPECT_EQ(controller.GetVisibleEntry()->GetOriginalRequestURL(), history_url);
83 } 77 }
84 78
85 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, UniqueIDs) { 79 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, UniqueIDs) {
86 const NavigationControllerImpl& controller = 80 const NavigationControllerImpl& controller =
87 static_cast<const NavigationControllerImpl&>( 81 static_cast<const NavigationControllerImpl&>(
88 shell()->web_contents()->GetController()); 82 shell()->web_contents()->GetController());
89 83
90 GURL main_url(embedded_test_server()->GetURL( 84 GURL main_url(embedded_test_server()->GetURL(
91 "/navigation_controller/page_with_link_to_load_iframe.html")); 85 "/navigation_controller/page_with_link_to_load_iframe.html"));
92 NavigateToURL(shell(), main_url); 86 NavigateToURL(shell(), main_url);
(...skipping 2425 matching lines...) Expand 10 before | Expand all | Expand 10 after
2518 EXPECT_EQ(original_url, capturer.all_params()[1].url); 2512 EXPECT_EQ(original_url, capturer.all_params()[1].url);
2519 EXPECT_EQ(original_url, shell()->web_contents()->GetLastCommittedURL()); 2513 EXPECT_EQ(original_url, shell()->web_contents()->GetLastCommittedURL());
2520 } 2514 }
2521 2515
2522 // Make sure the renderer is still alive. 2516 // Make sure the renderer is still alive.
2523 EXPECT_TRUE( 2517 EXPECT_TRUE(
2524 ExecuteScript(shell()->web_contents(), "console.log('Success');")); 2518 ExecuteScript(shell()->web_contents(), "console.log('Success');"));
2525 } 2519 }
2526 2520
2527 } // namespace content 2521 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698