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

Unified Diff: chrome/browser/android/url_sanitize_utils_unittest.cc

Issue 646333002: Update EscapeExternalHandlerValue to keep '#', '[', and ']' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sanitize fragment and path Created 6 years, 2 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
Index: chrome/browser/android/url_sanitize_utils_unittest.cc
diff --git a/chrome/browser/android/url_sanitize_utils_unittest.cc b/chrome/browser/android/url_sanitize_utils_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0c06ca91e783ef207eb2be7feb761e90b8a4e534
--- /dev/null
+++ b/chrome/browser/android/url_sanitize_utils_unittest.cc
@@ -0,0 +1,28 @@
+// 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 "chrome/browser/android/url_sanitize_utils.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace chrome {
+namespace android {
+
+class UrlSanitizeUtilsTest : public testing::Test {};
+
+TEST_F(UrlSanitizeUtilsTest, SanitizeUrl) {
+ EXPECT_EQ("http://example.com/path%5B%5D/sub?q=a%7Cb%7Cc&q=1%7C2%7C3#ref%7C",
+ SanitizeUrl(GURL("http://example.com/path[]/"
+ "sub?q=a|b|c&q=1|2|3#ref|")).spec());
+
+ EXPECT_EQ("http://example.com/path%5B%5D/sub?q=a%7Cb%7Cc&q=1%7C2%7C3#ref%7C",
+ SanitizeUrl(GURL("http://example.com/path%5B%5D/"
+ "sub?q=a%7Cb%7Cc&q=1%7C2%7C3#ref%7C")).spec());
+
+ EXPECT_EQ("http://example.com/",
+ SanitizeUrl(GURL("http://example.com/")).spec());
+}
+
+} // namespace android
+} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698