| 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
|
|
|