OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "ios/web/public/url_scheme_util.h" | 5 #import "ios/web/public/url_scheme_util.h" |
6 | 6 |
7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 | 8 |
9 #import "testing/gtest_mac.h" | 9 #import "testing/gtest_mac.h" |
10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
11 | 11 |
| 12 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 13 #error "This file requires ARC support." |
| 14 #endif |
| 15 |
12 namespace web { | 16 namespace web { |
13 | 17 |
14 TEST(URLSchemeUtilTest, UrlHasWebScheme) { | 18 TEST(URLSchemeUtilTest, UrlHasWebScheme) { |
15 EXPECT_TRUE(UrlHasWebScheme(GURL("http://foo.com"))); | 19 EXPECT_TRUE(UrlHasWebScheme(GURL("http://foo.com"))); |
16 EXPECT_TRUE(UrlHasWebScheme(GURL("https://foo.com"))); | 20 EXPECT_TRUE(UrlHasWebScheme(GURL("https://foo.com"))); |
17 EXPECT_TRUE(UrlHasWebScheme(GURL("data:text/html;charset=utf-8,Hello"))); | 21 EXPECT_TRUE(UrlHasWebScheme(GURL("data:text/html;charset=utf-8,Hello"))); |
18 EXPECT_FALSE(UrlHasWebScheme(GURL("about:blank"))); | 22 EXPECT_FALSE(UrlHasWebScheme(GURL("about:blank"))); |
19 EXPECT_FALSE(UrlHasWebScheme(GURL("chrome://settings"))); | 23 EXPECT_FALSE(UrlHasWebScheme(GURL("chrome://settings"))); |
20 } | 24 } |
21 | 25 |
22 TEST(URLSchemeUtilTest, NSURLHasWebScheme) { | 26 TEST(URLSchemeUtilTest, NSURLHasWebScheme) { |
23 EXPECT_TRUE(UrlHasWebScheme([NSURL URLWithString:@"http://foo.com"])); | 27 EXPECT_TRUE(UrlHasWebScheme([NSURL URLWithString:@"http://foo.com"])); |
24 EXPECT_TRUE(UrlHasWebScheme([NSURL URLWithString:@"https://foo.com"])); | 28 EXPECT_TRUE(UrlHasWebScheme([NSURL URLWithString:@"https://foo.com"])); |
25 EXPECT_TRUE(UrlHasWebScheme( | 29 EXPECT_TRUE(UrlHasWebScheme( |
26 [NSURL URLWithString:@"data:text/html;charset=utf-8,Hello"])); | 30 [NSURL URLWithString:@"data:text/html;charset=utf-8,Hello"])); |
27 EXPECT_FALSE(UrlHasWebScheme([NSURL URLWithString:@"about:blank"])); | 31 EXPECT_FALSE(UrlHasWebScheme([NSURL URLWithString:@"about:blank"])); |
28 EXPECT_FALSE(UrlHasWebScheme([NSURL URLWithString:@"chrome://settings"])); | 32 EXPECT_FALSE(UrlHasWebScheme([NSURL URLWithString:@"chrome://settings"])); |
29 } | 33 } |
30 | 34 |
31 } // namespace web | 35 } // namespace web |
OLD | NEW |