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

Side by Side Diff: chrome/browser/net/browser_url_util_unittest.cc

Issue 9117048: Revert r118627 and r118640 "Update Gaia URL." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/net/browser_url_util.cc ('k') | chrome/browser/net/gaia/gaia_oauth_fetcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/net/browser_url_util.h" 5 #include "chrome/browser/net/browser_url_util.h"
6 6
7 #include "googleurl/src/gurl.h" 7 #include "googleurl/src/gurl.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace chrome_browser_net { 10 namespace chrome_browser_net {
11 11
(...skipping 10 matching lines...) Expand all
22 AppendQueryParameter(GURL("http://example.com/path?existing=one"), 22 AppendQueryParameter(GURL("http://example.com/path?existing=one"),
23 "name", "value").spec()); 23 "name", "value").spec());
24 24
25 // Appending a name-value pair with unsafe characters included. The 25 // Appending a name-value pair with unsafe characters included. The
26 // unsafe characters should be escaped. 26 // unsafe characters should be escaped.
27 EXPECT_EQ("http://example.com/path?existing=one&na+me=v.alue%3D", 27 EXPECT_EQ("http://example.com/path?existing=one&na+me=v.alue%3D",
28 AppendQueryParameter(GURL("http://example.com/path?existing=one"), 28 AppendQueryParameter(GURL("http://example.com/path?existing=one"),
29 "na me", "v.alue=").spec()); 29 "na me", "v.alue=").spec());
30 } 30 }
31 31
32 TEST(BrowserUrlUtilTest, GetValueForKeyInQuery) {
33 GURL url("http://example.com/path?name=value&boolParam&"
34 "url=http://test.com/q?n1%3Dv1%26n2");
35 std::string value;
36
37 // False when getting a non-existent query param.
38 EXPECT_FALSE(GetValueForKeyInQuery(url, "non-exist", &value));
39
40 // True when query param exist.
41 EXPECT_TRUE(GetValueForKeyInQuery(url, "name", &value));
42 EXPECT_EQ("value", value);
43
44 EXPECT_TRUE(GetValueForKeyInQuery(url, "boolParam", &value));
45 EXPECT_EQ("", value);
46
47 EXPECT_TRUE(GetValueForKeyInQuery(url, "url", &value));
48 EXPECT_EQ("http://test.com/q?n1=v1&n2", value);
49 }
50
51 } // namespace chrome_browser_net. 32 } // namespace chrome_browser_net.
OLDNEW
« no previous file with comments | « chrome/browser/net/browser_url_util.cc ('k') | chrome/browser/net/gaia/gaia_oauth_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698