1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #import "ios/web/public/url_scheme_util.h"
7 #import <Foundation/Foundation.h>
9 #import "testing/gtest_mac.h"
14 TEST(URLSchemeUtilTest, UrlHasWebScheme) {
15 EXPECT_TRUE(UrlHasWebScheme(GURL("http://foo.com")));
16 EXPECT_TRUE(UrlHasWebScheme(GURL("https://foo.com")));
17 EXPECT_TRUE(UrlHasWebScheme(GURL("data:text/html;charset=utf-8,Hello")));
18 EXPECT_FALSE(UrlHasWebScheme(GURL("about:blank")));
19 EXPECT_FALSE(UrlHasWebScheme(GURL("chrome://settings")));
22 TEST(URLSchemeUtilTest, NSURLHasWebScheme) {
23 EXPECT_TRUE(UrlHasWebScheme([NSURL URLWithString:@"http://foo.com"]));
24 EXPECT_TRUE(UrlHasWebScheme([NSURL URLWithString:@"https://foo.com"]));
25 EXPECT_TRUE(UrlHasWebScheme(
26 [NSURL URLWithString:@"data:text/html;charset=utf-8,Hello"]));
27 EXPECT_FALSE(UrlHasWebScheme([NSURL URLWithString:@"about:blank"]));
28 EXPECT_FALSE(UrlHasWebScheme([NSURL URLWithString:@"chrome://settings"]));