| 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/chrome/browser/chrome_url_util.h" | 5 #import "ios/chrome/browser/chrome_url_util.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #include "ios/chrome/browser/chrome_url_constants.h" | 9 #include "ios/chrome/browser/chrome_url_constants.h" |
| 10 #import "net/base/mac/url_conversions.h" | 10 #import "net/base/mac/url_conversions.h" |
| 11 #import "testing/gtest_mac.h" | 11 #import "testing/gtest_mac.h" |
| 12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 13 | 13 |
| 14 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 15 #error "This file requires ARC support." |
| 16 #endif |
| 17 |
| 14 namespace { | 18 namespace { |
| 15 | 19 |
| 16 TEST(ChromeURLUtilTest, TestIsExternalFileReference) { | 20 TEST(ChromeURLUtilTest, TestIsExternalFileReference) { |
| 17 GURL external_url("chrome://external-file/foo/bar"); | 21 GURL external_url("chrome://external-file/foo/bar"); |
| 18 GURL not_external_url("chrome://foo/bar"); | 22 GURL not_external_url("chrome://foo/bar"); |
| 19 GURL still_not_external_url("http://external-file/foo/bar"); | 23 GURL still_not_external_url("http://external-file/foo/bar"); |
| 20 EXPECT_TRUE(UrlIsExternalFileReference(external_url)); | 24 EXPECT_TRUE(UrlIsExternalFileReference(external_url)); |
| 21 EXPECT_FALSE(UrlIsExternalFileReference(not_external_url)); | 25 EXPECT_FALSE(UrlIsExternalFileReference(not_external_url)); |
| 22 EXPECT_FALSE(UrlIsExternalFileReference(still_not_external_url)); | 26 EXPECT_FALSE(UrlIsExternalFileReference(still_not_external_url)); |
| 23 } | 27 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 63 |
| 60 // Verifies that Chrome scheme can be reset for testing. | 64 // Verifies that Chrome scheme can be reset for testing. |
| 61 [constants setCallbackSchemeForTesting:@"blah"]; | 65 [constants setCallbackSchemeForTesting:@"blah"]; |
| 62 EXPECT_NSEQ(@"blah", [constants getBundleURLScheme]); | 66 EXPECT_NSEQ(@"blah", [constants getBundleURLScheme]); |
| 63 | 67 |
| 64 // Resets state in case of further tests. | 68 // Resets state in case of further tests. |
| 65 [constants setCallbackSchemeForTesting:originalScheme]; | 69 [constants setCallbackSchemeForTesting:originalScheme]; |
| 66 } | 70 } |
| 67 | 71 |
| 68 } // namespace | 72 } // namespace |
| OLD | NEW |