| Index: chrome/browser/net/browser_url_util_unittest.cc
|
| diff --git a/chrome/browser/net/browser_url_util_unittest.cc b/chrome/browser/net/browser_url_util_unittest.cc
|
| index 830024f1940277254926b800fb6e6dfbf74166e8..e3c43881b30d06eaa5483e1e4afe9390015b627f 100644
|
| --- a/chrome/browser/net/browser_url_util_unittest.cc
|
| +++ b/chrome/browser/net/browser_url_util_unittest.cc
|
| @@ -1,4 +1,4 @@
|
| -// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| +// Copyright (c) 2012 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.
|
|
|
| @@ -29,4 +29,23 @@ TEST(BrowserUrlUtilTest, AppendQueryParameter) {
|
| "na me", "v.alue=").spec());
|
| }
|
|
|
| +TEST(BrowserUrlUtilTest, GetValueForKeyInQuery) {
|
| + GURL url("http://example.com/path?name=value&boolParam&"
|
| + "url=http://test.com/q?n1%3Dv1%26n2");
|
| + std::string value;
|
| +
|
| + // False when getting a non-existent query param.
|
| + EXPECT_FALSE(GetValueForKeyInQuery(url, "non-exist", &value));
|
| +
|
| + // True when query param exist.
|
| + EXPECT_TRUE(GetValueForKeyInQuery(url, "name", &value));
|
| + EXPECT_EQ("value", value);
|
| +
|
| + EXPECT_TRUE(GetValueForKeyInQuery(url, "boolParam", &value));
|
| + EXPECT_EQ("", value);
|
| +
|
| + EXPECT_TRUE(GetValueForKeyInQuery(url, "url", &value));
|
| + EXPECT_EQ("http://test.com/q?n1=v1&n2", value);
|
| +}
|
| +
|
| } // namespace chrome_browser_net.
|
|
|