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

Unified Diff: url/origin_unittest.cc

Issue 170843007: Introduce url::Origin to represent Web Origin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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 | « url/origin.cc ('k') | url/url.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: url/origin_unittest.cc
diff --git a/url/origin_unittest.cc b/url/origin_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d08342e04d1006ec018c3d8eed5e544770f9c589
--- /dev/null
+++ b/url/origin_unittest.cc
@@ -0,0 +1,36 @@
+// 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 "testing/gtest/include/gtest/gtest.h"
+#include "url/origin.h"
+
+namespace url {
+
+namespace {
+
+// Each test examines the Origin is constructed correctly without
+// violating DCHECKs.
+TEST(OriginTest, constructEmpty) {
+ Origin origin;
+ EXPECT_EQ("null", origin.string());
+}
+
+TEST(OriginTest, constructNull) {
+ Origin origin("null");
+ EXPECT_EQ("null", origin.string());
+}
+
+TEST(OriginTest, constructValidOrigin) {
+ Origin origin("http://example.com:8080");
+ EXPECT_EQ("http://example.com:8080", origin.string());
+}
+
+TEST(OriginTest, constructValidOriginWithoutPort) {
+ Origin origin("wss://example2.com");
+ EXPECT_EQ("wss://example2.com", origin.string());
+}
+
+} // namespace
+
+} // namespace url
« no previous file with comments | « url/origin.cc ('k') | url/url.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698