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

Unified Diff: chrome/browser/net/browser_url_util_unittest.cc

Issue 10384086: Moved url_utils from chrome/browser/net to chrome/common/net. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/net/browser_url_util.cc ('k') | chrome/browser/tab_contents/render_view_context_menu.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
deleted file mode 100644
index b9a0b2ee63df186b56e80be02a10fb1a0f30b4a0..0000000000000000000000000000000000000000
--- a/chrome/browser/net/browser_url_util_unittest.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-// 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.
-
-#include "chrome/browser/net/browser_url_util.h"
-
-#include "googleurl/src/gurl.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace chrome_browser_net {
-
-TEST(BrowserUrlUtilTest, AppendQueryParameter) {
- // Appending a name-value pair to a URL without a query component.
- EXPECT_EQ("http://example.com/path?name=value",
- AppendQueryParameter(GURL("http://example.com/path"),
- "name", "value").spec());
-
- // Appending a name-value pair to a URL with a query component.
- // The original component should be preserved, and the new pair should be
- // appended with '&'.
- EXPECT_EQ("http://example.com/path?existing=one&name=value",
- AppendQueryParameter(GURL("http://example.com/path?existing=one"),
- "name", "value").spec());
-
- // Appending a name-value pair with unsafe characters included. The
- // unsafe characters should be escaped.
- EXPECT_EQ("http://example.com/path?existing=one&na+me=v.alue%3D",
- AppendQueryParameter(GURL("http://example.com/path?existing=one"),
- "na me", "v.alue=").spec());
-
-}
-
-TEST(BrowserUrlUtilTest, AppendOrReplaceQueryParameter) {
- // Appending a name-value pair to a URL without a query component.
- EXPECT_EQ("http://example.com/path?name=value",
- AppendOrReplaceQueryParameter(GURL("http://example.com/path"),
- "name", "value").spec());
-
- // Appending a name-value pair to a URL with a query component.
- // The original component should be preserved, and the new pair should be
- // appended with '&'.
- EXPECT_EQ("http://example.com/path?existing=one&name=value",
- AppendOrReplaceQueryParameter(
- GURL("http://example.com/path?existing=one"),
- "name", "value").spec());
-
- // Appending a name-value pair with unsafe characters included. The
- // unsafe characters should be escaped.
- EXPECT_EQ("http://example.com/path?existing=one&na+me=v.alue%3D",
- AppendOrReplaceQueryParameter(
- GURL("http://example.com/path?existing=one"),
- "na me", "v.alue=").spec());
-
- // Replace value of an existing paramater.
- EXPECT_EQ("http://example.com/path?existing=one&name=new",
- AppendOrReplaceQueryParameter(
- GURL("http://example.com/path?existing=one&name=old"),
- "name", "new").spec());
-
- // Replace a name-value pair with unsafe characters included. The
- // unsafe characters should be escaped.
- EXPECT_EQ("http://example.com/path?na+me=n.ew%3D&existing=one",
- AppendOrReplaceQueryParameter(
- GURL("http://example.com/path?na+me=old&existing=one"),
- "na me", "n.ew=").spec());
-
- // Replace the value of first parameter with this name only.
- EXPECT_EQ("http://example.com/path?name=new&existing=one&name=old",
- AppendOrReplaceQueryParameter(
- GURL("http://example.com/path?name=old&existing=one&name=old"),
- "name", "new").spec());
-
- // Preserve the content of the original params regarless of our failure to
- // interpret them correctly.
- EXPECT_EQ("http://example.com/path?bar&name=new&left=&"
- "=right&=&&name=again",
- AppendOrReplaceQueryParameter(
- GURL("http://example.com/path?bar&name=old&left=&"
- "=right&=&&name=again"),
- "name", "new").spec());
-}
-
-} // namespace chrome_browser_net.
« no previous file with comments | « chrome/browser/net/browser_url_util.cc ('k') | chrome/browser/tab_contents/render_view_context_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698