Index: chrome/browser/browser_about_handler_unittest.cc |
diff --git a/chrome/browser/browser_about_handler_unittest.cc b/chrome/browser/browser_about_handler_unittest.cc |
index 2754d4948814b12395d16a0ac895cef3f6904f7a..2448653ab24c3e07bfe12580c0d6957945ee5a92 100644 |
--- a/chrome/browser/browser_about_handler_unittest.cc |
+++ b/chrome/browser/browser_about_handler_unittest.cc |
@@ -8,11 +8,17 @@ |
#include "chrome/browser/browser_about_handler.h" |
#include "chrome/common/url_constants.h" |
#include "chrome/test/base/testing_profile.h" |
+#include "content/public/browser/navigation_controller.h" |
+#include "content/public/browser/navigation_entry.h" |
+#include "content/public/common/referrer.h" |
#include "content/public/test/test_browser_thread.h" |
#include "testing/gtest/include/gtest/gtest.h" |
#include "url/gurl.h" |
using content::BrowserThread; |
+using content::NavigationController; |
+using content::NavigationEntry; |
+using content::Referrer; |
typedef testing::Test BrowserAboutHandlerTest; |
@@ -74,3 +80,24 @@ TEST_F(BrowserAboutHandlerTest, WillHandleBrowserAboutURL) { |
EXPECT_EQ(test_data[i].result_url, url); |
} |
} |
+ |
+// Ensure that minor BrowserAboutHandler fixup to a URL does not cause us to |
+// keep a separate virtual URL, which would not be updated on redirects. |
+// See https://crbug.com/449829. |
+TEST_F(BrowserAboutHandlerTest, NoVirtualURLForFixup) { |
+ GURL url("view-source:http://.foo"); |
+ |
+ // Fixup will remove the dot and add a slash. |
+ GURL fixed_url("view-source:http://foo/"); |
+ |
+ // Rewriters will remove the view-source prefix and expect it to stay in the |
+ // virtual URL. |
+ GURL rewritten_url("http://foo/"); |
+ |
+ TestingProfile profile; |
+ scoped_ptr<NavigationEntry> entry(NavigationController::CreateNavigationEntry( |
+ url, Referrer(), ui::PAGE_TRANSITION_RELOAD, false, std::string(), |
+ &profile)); |
+ EXPECT_EQ(fixed_url, entry->GetVirtualURL()); |
+ EXPECT_EQ(rewritten_url, entry->GetURL()); |
+} |