Index: content/common/url_schemes_unittest.cc |
diff --git a/content/common/url_schemes_unittest.cc b/content/common/url_schemes_unittest.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d2b1a69c03b17b7aab8f80989b744e8a2fc744f4 |
--- /dev/null |
+++ b/content/common/url_schemes_unittest.cc |
@@ -0,0 +1,35 @@ |
+// Copyright (c) 2015 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 "content/public/common/origin_util.h" |
+ |
+#include "testing/gtest/include/gtest/gtest.h" |
+#include "url/gurl.h" |
+ |
+TEST(URLSchemesTest, IsOriginSecure) { |
+ EXPECT_TRUE(content::IsOriginSecure(GURL("file:///test/fun.html"))); |
+ EXPECT_TRUE(content::IsOriginSecure(GURL("file:///test/"))); |
+ |
+ EXPECT_TRUE(content::IsOriginSecure(GURL("https://example.com/fun.html"))); |
+ EXPECT_FALSE(content::IsOriginSecure(GURL("http://example.com/fun.html"))); |
+ |
+ EXPECT_TRUE(content::IsOriginSecure(GURL("wss://example.com/fun.html"))); |
+ EXPECT_FALSE(content::IsOriginSecure(GURL("ws://example.com/fun.html"))); |
+ |
+ EXPECT_TRUE(content::IsOriginSecure(GURL("http://localhost/fun.html"))); |
+ EXPECT_FALSE(content::IsOriginSecure(GURL("http://localhost.com/fun.html"))); |
+ EXPECT_TRUE(content::IsOriginSecure(GURL("https://localhost.com/fun.html"))); |
+ |
+ EXPECT_TRUE(content::IsOriginSecure(GURL("http://127.0.0.1/fun.html"))); |
+ EXPECT_TRUE(content::IsOriginSecure(GURL("http://127.3.0.1/fun.html"))); |
+ EXPECT_FALSE( |
+ content::IsOriginSecure(GURL("http://127.example.com/fun.html"))); |
+ EXPECT_TRUE( |
+ content::IsOriginSecure(GURL("https://127.example.com/fun.html"))); |
+ |
+ EXPECT_TRUE(content::IsOriginSecure(GURL("http://[::1]/fun.html"))); |
+ EXPECT_FALSE(content::IsOriginSecure(GURL("http://[::2]/fun.html"))); |
+ EXPECT_FALSE( |
+ content::IsOriginSecure(GURL("http://[::1].example.com/fun.html"))); |
+} |