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

Unified Diff: content/browser/frame_host/navigation_controller_impl_browsertest.cc

Issue 176883012: Set the original url correctly if the frame is loaded via loadData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase correctly Created 6 years, 8 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/content_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/navigation_controller_impl_browsertest.cc
diff --git a/content/browser/frame_host/navigation_controller_impl_browsertest.cc b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..20c00ee3edf6db7935e6a6736402a33b134708f7
--- /dev/null
+++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
@@ -0,0 +1,34 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/bind.h"
+#include "content/browser/frame_host/navigation_controller_impl.h"
+#include "content/browser/frame_host/navigation_entry_impl.h"
+#include "content/public/browser/web_contents.h"
+#include "content/public/test/content_browser_test.h"
+#include "content/public/test/content_browser_test_utils.h"
+#include "content/shell/browser/shell.h"
+
+namespace content {
+
+class NavigationControllerBrowserTest : public ContentBrowserTest {
+};
+
+IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, LoadDataWithBaseURL) {
+ const GURL base_url("http://baseurl");
+ const GURL history_url("http://historyurl");
+ const std::string data = "<html><body>foo</body></html>";
+
+ const NavigationController& controller =
+ shell()->web_contents()->GetController();
+ // load data. Blocks until it is done.
+ content::LoadDataWithBaseURL(shell(), history_url, data, base_url);
+
+ // We should use history_url instead of the base_url as the original url of
+ // this navigation entry, because base_url is only used for resolving relative
+ // paths in the data, or enforcing same origin policy.
+ EXPECT_EQ(controller.GetVisibleEntry()->GetOriginalRequestURL(), history_url);
+}
+} // namespace content
+
« no previous file with comments | « no previous file | content/content_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698