// 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 = "foo"; 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