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

Unified Diff: components/dom_distiller/core/url_utils_unittest.cc

Issue 151003006: Add support for distilling arbitrary URLs in DOM Distiller Viewer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed all comments Created 6 years, 10 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
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
new file mode 100644
index 0000000000000000000000000000000000000000..acc9f9af03227a0ad8a7073e62ff90065b92f845
--- /dev/null
+++ b/components/dom_distiller/core/url_utils_unittest.cc
@@ -0,0 +1,25 @@
+// Copyright 2014 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 "components/dom_distiller/core/url_utils.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace dom_distiller {
+
+namespace url_utils {
+
+TEST(DomDistillerUrlUtils, TestPathUtil) {
+ const std::string single_key = "mypath?foo=bar";
+ EXPECT_EQ("bar", GetValueForKeyInURLPathQuery(single_key, "foo"));
+ const std::string two_keys = "mypath?key1=foo&key2=bar";
+ EXPECT_EQ("foo", GetValueForKeyInURLPathQuery(two_keys, "key1"));
+ EXPECT_EQ("bar", GetValueForKeyInURLPathQuery(two_keys, "key2"));
+ const std::string multiple_same_key = "mypath?key=foo&key=bar";
+ EXPECT_EQ("foo", GetValueForKeyInURLPathQuery(multiple_same_key, "key"));
+}
+
+} // namespace url_utils
+
+} // namespace dom_distiller

Powered by Google App Engine
This is Rietveld 408576698