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/chrome/test/earl_grey/chrome_earl_grey.h" | 5 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" |
6 | 6 |
7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 #import <WebKit/WebKit.h> | 8 #import <WebKit/WebKit.h> |
9 | 9 |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
11 #import "ios/chrome/test/app/chrome_test_util.h" | 11 #import "ios/chrome/test/app/chrome_test_util.h" |
12 #include "ios/chrome/test/app/history_test_util.h" | 12 #import "ios/chrome/test/app/history_test_util.h" |
13 #include "ios/chrome/test/app/navigation_test_util.h" | 13 #include "ios/chrome/test/app/navigation_test_util.h" |
14 #import "ios/testing/wait_util.h" | 14 #import "ios/testing/wait_util.h" |
15 #import "ios/web/public/test/earl_grey/js_test_util.h" | 15 #import "ios/web/public/test/earl_grey/js_test_util.h" |
16 #import "ios/web/public/test/web_view_interaction_test_util.h" | 16 #import "ios/web/public/test/web_view_interaction_test_util.h" |
17 #import "ios/web/public/web_state/js/crw_js_injection_receiver.h" | 17 #import "ios/web/public/web_state/js/crw_js_injection_receiver.h" |
18 #include "ios/web/public/web_state/web_state.h" | 18 #import "ios/web/public/web_state/web_state.h" |
19 | 19 |
20 namespace chrome_test_util { | 20 namespace chrome_test_util { |
21 | 21 |
22 id ExecuteJavaScript(NSString* javascript, NSError** out_error) { | 22 id ExecuteJavaScript(NSString* javascript, NSError** out_error) { |
23 __block bool did_complete = false; | 23 __block bool did_complete = false; |
24 __block id result = nil; | 24 __block id result = nil; |
25 __block NSError* temp_error = nil; | 25 __block NSError* temp_error = nil; |
26 CRWJSInjectionReceiver* evaluator = | 26 CRWJSInjectionReceiver* evaluator = |
27 chrome_test_util::GetCurrentWebState()->GetJSInjectionReceiver(); | 27 chrome_test_util::GetCurrentWebState()->GetJSInjectionReceiver(); |
28 [evaluator executeJavaScript:javascript | 28 [evaluator executeJavaScript:javascript |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 BOOL success = | 87 BOOL success = |
88 web::test::TapWebViewElementWithId(chrome_test_util::GetCurrentWebState(), | 88 web::test::TapWebViewElementWithId(chrome_test_util::GetCurrentWebState(), |
89 base::SysNSStringToUTF8(elementID)); | 89 base::SysNSStringToUTF8(elementID)); |
90 GREYAssertTrue( | 90 GREYAssertTrue( |
91 success, | 91 success, |
92 [NSString stringWithFormat:@"Failed to tap web view element with ID: %@", | 92 [NSString stringWithFormat:@"Failed to tap web view element with ID: %@", |
93 elementID]); | 93 elementID]); |
94 } | 94 } |
95 | 95 |
96 @end | 96 @end |
OLD | NEW |