OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/origin_util.h" | 5 #import "ios/web/public/origin_util.h" |
6 | 6 |
7 #import <WebKit/WebKit.h> | 7 #import <WebKit/WebKit.h> |
8 | 8 |
9 #include "base/mac/objc_property_releaser.h" | 9 #import "base/mac/objc_property_releaser.h" |
10 #include "base/mac/scoped_nsobject.h" | 10 #import "base/mac/scoped_nsobject.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
13 | 13 |
14 // WKSecurityOrigin can not be manually created, hence stub is needed. | 14 // WKSecurityOrigin can not be manually created, hence stub is needed. |
15 @interface WKSecurityOriginStub : NSObject | 15 @interface WKSecurityOriginStub : NSObject |
16 // Methods from WKSecurityOrigin class. | 16 // Methods from WKSecurityOrigin class. |
17 @property(nonatomic, copy) NSString* protocol; | 17 @property(nonatomic, copy) NSString* protocol; |
18 @property(nonatomic, copy) NSString* host; | 18 @property(nonatomic, copy) NSString* host; |
19 @property(nonatomic) NSInteger port; | 19 @property(nonatomic) NSInteger port; |
20 @end | 20 @end |
(...skipping 30 matching lines...) Expand all Loading... |
51 [origin setHost:@"chromium.org"]; | 51 [origin setHost:@"chromium.org"]; |
52 [origin setPort:80]; | 52 [origin setPort:80]; |
53 | 53 |
54 GURL url(GURLOriginWithWKSecurityOrigin( | 54 GURL url(GURLOriginWithWKSecurityOrigin( |
55 static_cast<WKSecurityOrigin*>(origin.get()))); | 55 static_cast<WKSecurityOrigin*>(origin.get()))); |
56 EXPECT_EQ("http://chromium.org/", url.spec()); | 56 EXPECT_EQ("http://chromium.org/", url.spec()); |
57 EXPECT_TRUE(url.port().empty()); | 57 EXPECT_TRUE(url.port().empty()); |
58 } | 58 } |
59 | 59 |
60 } // namespace web | 60 } // namespace web |
OLD | NEW |