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 <EarlGrey/EarlGrey.h> | 5 #import <EarlGrey/EarlGrey.h> |
6 #import <XCTest/XCTest.h> | 6 #import <XCTest/XCTest.h> |
7 | 7 |
8 #import "components/handoff/handoff_manager.h" | 8 #import "components/handoff/handoff_manager.h" |
9 #import "ios/chrome/browser/device_sharing/device_sharing_manager.h" | 9 #import "ios/chrome/browser/device_sharing/device_sharing_manager.h" |
10 #include "ios/chrome/browser/ui/ui_util.h" | 10 #include "ios/chrome/browser/ui/ui_util.h" |
11 #import "ios/chrome/test/app/chrome_test_util.h" | 11 #import "ios/chrome/test/app/chrome_test_util.h" |
12 #import "ios/chrome/test/app/tab_test_util.h" | 12 #import "ios/chrome/test/app/tab_test_util.h" |
13 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" | 13 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" |
14 #import "ios/chrome/test/earl_grey/chrome_test_case.h" | 14 #import "ios/chrome/test/earl_grey/chrome_test_case.h" |
15 #include "ios/web/public/test/http_server.h" | 15 #include "ios/web/public/test/http_server.h" |
16 #include "ios/web/public/test/http_server_util.h" | 16 #include "ios/web/public/test/http_server_util.h" |
17 #import "net/base/mac/url_conversions.h" | 17 #import "net/base/mac/url_conversions.h" |
18 #include "url/gurl.h" | 18 #include "url/gurl.h" |
19 | 19 |
| 20 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 21 #error "This file requires ARC support." |
| 22 #endif |
| 23 |
20 namespace { | 24 namespace { |
21 | 25 |
22 // Checks that Handoff will report the specified |gurl|. | 26 // Checks that Handoff will report the specified |gurl|. |
23 void AssertHandoffURL(const GURL& gurl) { | 27 void AssertHandoffURL(const GURL& gurl) { |
24 HandoffManager* manager = | 28 HandoffManager* manager = |
25 [chrome_test_util::GetDeviceSharingManager() handoffManager]; | 29 [chrome_test_util::GetDeviceSharingManager() handoffManager]; |
26 GREYAssertTrue(manager != nil, @"Handoff Manager should not be nil"); | 30 GREYAssertTrue(manager != nil, @"Handoff Manager should not be nil"); |
27 if (gurl.is_valid()) { | 31 if (gurl.is_valid()) { |
28 NSURL* URL = net::NSURLWithGURL(gurl); | 32 NSURL* URL = net::NSURLWithGURL(gurl); |
29 GREYAssertTrue([manager.userActivityWebpageURL isEqual:URL], | 33 GREYAssertTrue([manager.userActivityWebpageURL isEqual:URL], |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 AssertHandoffURL(GURL()); | 140 AssertHandoffURL(GURL()); |
137 | 141 |
138 // Loads page three in a new normal tab and verify that Handoff URL is not | 142 // Loads page three in a new normal tab and verify that Handoff URL is not |
139 // nil. | 143 // nil. |
140 chrome_test_util::OpenNewTab(); | 144 chrome_test_util::OpenNewTab(); |
141 [ChromeEarlGrey loadURL:tab3URL]; | 145 [ChromeEarlGrey loadURL:tab3URL]; |
142 AssertHandoffURL(tab3URL); | 146 AssertHandoffURL(tab3URL); |
143 } | 147 } |
144 | 148 |
145 @end | 149 @end |
OLD | NEW |