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

Unified Diff: components/dom_distiller/core/url_utils_unittest.cc

Issue 442503002: Retrieve article original URL from entryID (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: string reference Created 6 years, 4 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: components/dom_distiller/core/url_utils_unittest.cc
diff --git a/components/dom_distiller/core/url_utils_unittest.cc b/components/dom_distiller/core/url_utils_unittest.cc
index 366433f6894edae227efeedd44335a038b5efd74..d19a3fe1a13acba0d898c397a401406eaed27203 100644
--- a/components/dom_distiller/core/url_utils_unittest.cc
+++ b/components/dom_distiller/core/url_utils_unittest.cc
@@ -20,6 +20,25 @@ TEST(DomDistillerUrlUtilsTest, TestPathUtil) {
EXPECT_EQ("foo", GetValueForKeyInUrlPathQuery(multiple_same_key, "key"));
}
+TEST(DomDistillerUrlUtilsTest, TestGetValueForKeyInUrlPathQuery) {
+ // Tests an invalid url.
+ const std::string invalid_url = "http://%40[::1]/";
+ EXPECT_EQ("", GetValueForKeyInUrlPathQuery(invalid_url, "key"));
+
+ // Test a valid URL with the key we are searching for.
+ const std::string valid_url_with_key = "http://www.google.com?key=foo";
+ EXPECT_EQ("foo", GetValueForKeyInUrlPathQuery(valid_url_with_key, "key"));
+
+ // Test a valid URL without the key we are searching for.
+ const std::string valid_url_no_key = "http://www.google.com";
+ EXPECT_EQ("", GetValueForKeyInUrlPathQuery(valid_url_no_key, "key"));
+
+ // Test a valid URL with 2 values of the key we are searching for.
+ const std::string valid_url_two_keys =
+ "http://www.google.com?key=foo&key=bar";
+ EXPECT_EQ("foo", GetValueForKeyInUrlPathQuery(valid_url_two_keys, "key"));
+}
+
} // namespace url_utils
} // namespace dom_distiller
« no previous file with comments | « components/dom_distiller/core/url_utils_android.cc ('k') | components/dom_distiller/core/viewer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698