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

Side by Side Diff: chrome/common/net/url_util_unittest.cc

Issue 10413016: It seems GAIA had changed dosserver rules today, so we can go back to accounts.google.com. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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/common/net/url_util.cc ('k') | chrome/common/url_constants.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:mergeinfo
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/common/net/url_util.h" 5 #include "chrome/common/net/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_common_net { 10 namespace chrome_common_net {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // Preserve the content of the original params regarless of our failure to 73 // Preserve the content of the original params regarless of our failure to
74 // interpret them correctly. 74 // interpret them correctly.
75 EXPECT_EQ("http://example.com/path?bar&name=new&left=&" 75 EXPECT_EQ("http://example.com/path?bar&name=new&left=&"
76 "=right&=&&name=again", 76 "=right&=&&name=again",
77 AppendOrReplaceQueryParameter( 77 AppendOrReplaceQueryParameter(
78 GURL("http://example.com/path?bar&name=old&left=&" 78 GURL("http://example.com/path?bar&name=old&left=&"
79 "=right&=&&name=again"), 79 "=right&=&&name=again"),
80 "name", "new").spec()); 80 "name", "new").spec());
81 } 81 }
82 82
83 TEST(BrowserUrlUtilTest, GetValueForKeyInQuery) {
84 GURL url("http://example.com/path?name=value&boolParam&"
85 "url=http://test.com/q?n1%3Dv1%26n2");
86 std::string value;
87
88 // False when getting a non-existent query param.
89 EXPECT_FALSE(GetValueForKeyInQuery(url, "non-exist", &value));
90
91 // True when query param exist.
92 EXPECT_TRUE(GetValueForKeyInQuery(url, "name", &value));
93 EXPECT_EQ("value", value);
94
95 EXPECT_TRUE(GetValueForKeyInQuery(url, "boolParam", &value));
96 EXPECT_EQ("", value);
97
98 EXPECT_TRUE(GetValueForKeyInQuery(url, "url", &value));
99 EXPECT_EQ("http://test.com/q?n1=v1&n2", value);
100 }
101
83 } // namespace chrome_common_net. 102 } // namespace chrome_common_net.
OLDNEW
« no previous file with comments | « chrome/common/net/url_util.cc ('k') | chrome/common/url_constants.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698