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..9aac5096c7c21cffde1442ff0702b8680344bf03 |
--- /dev/null |
+++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc |
@@ -0,0 +1,31 @@ |
+// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
darin (slow to review)
2014/03/27 08:10:28
nit: Please drop the "(c)" from the header. We use
hush (inactive)
2014/03/27 20:15:00
Done.
|
+// 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/shell/browser/shell.h" |
+#include "content/test/content_browser_test.h" |
+#include "content/test/content_browser_test_utils.h" |
+ |
+namespace content { |
darin (slow to review)
2014/03/27 08:10:28
nit: add a new line here between the namespace and
hush (inactive)
2014/03/27 20:15:00
Done.
|
+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>"; |
+ |
+ NavigationController& controller = shell()->web_contents()->GetController(); |
darin (slow to review)
2014/03/27 08:10:28
nit: We generally avoid non-const references in Ch
hush (inactive)
2014/03/27 20:15:00
Done.
|
+ // load data. Blocks until it is done. |
+ content::LoadDataWithBaseURL(shell(), base_url, data, history_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 |
darin (slow to review)
2014/03/27 08:10:28
nit: add a new line above here.
hush (inactive)
2014/03/27 20:15:00
Done.
|