Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(680)

Side by Side Diff: ios/web_view/test/web_view_test_util.mm

Issue 2941763003: Cleanup ios_web_view integration tests. (Closed)
Patch Set: Addressed review comments Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/web_view/test/web_view_test_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_view/test/web_view_interaction_test_util.h" 5 #import "ios/web_view/test/web_view_test_util.h"
6 6
7 #import <ChromeWebView/ChromeWebView.h> 7 #import <ChromeWebView/ChromeWebView.h>
8 8
9 #import "ios/testing/wait_util.h" 9 #import "ios/testing/wait_util.h"
10 10
11 #if !defined(__has_feature) || !__has_feature(objc_arc) 11 #if !defined(__has_feature) || !__has_feature(objc_arc)
12 #error "This file requires ARC support." 12 #error "This file requires ARC support."
13 #endif 13 #endif
14 14
15 using testing::WaitUntilConditionOrTimeout; 15 using testing::WaitUntilConditionOrTimeout;
16 16
17 namespace ios_web_view { 17 namespace ios_web_view {
18 namespace test { 18 namespace test {
19 19
20 CWVWebView* CreateWebView() {
21 return [[CWVWebView alloc]
22 initWithFrame:UIScreen.mainScreen.bounds
23 configuration:[CWVWebViewConfiguration defaultConfiguration]];
24 }
25
20 bool TapChromeWebViewElementWithId(CWVWebView* web_view, NSString* element_id) { 26 bool TapChromeWebViewElementWithId(CWVWebView* web_view, NSString* element_id) {
21 // TODO(crbug.com/725524): Share this script with Chrome. 27 // TODO(crbug.com/725524): Share this script with Chrome.
22 NSString* script = [NSString 28 NSString* script = [NSString
23 stringWithFormat:@"(function() {" 29 stringWithFormat:@"(function() {"
24 " var element = document.getElementById('%@');" 30 " var element = document.getElementById('%@');"
25 " if (element) {" 31 " if (element) {"
26 " element.click();" 32 " element.click();"
27 " return true;" 33 " return true;"
28 " }" 34 " }"
29 " return false;" 35 " return false;"
(...skipping 27 matching lines...) Expand all
57 NSString* text) { 63 NSString* text) {
58 return WaitUntilConditionOrTimeout(testing::kWaitForUIElementTimeout, ^{ 64 return WaitUntilConditionOrTimeout(testing::kWaitForUIElementTimeout, ^{
59 id body = ios_web_view::test::EvaluateJavaScript( 65 id body = ios_web_view::test::EvaluateJavaScript(
60 web_view, @"document.body ? document.body.textContent : null", nil); 66 web_view, @"document.body ? document.body.textContent : null", nil);
61 return [body isKindOfClass:[NSString class]] && [body containsString:text]; 67 return [body isKindOfClass:[NSString class]] && [body containsString:text];
62 }); 68 });
63 } 69 }
64 70
65 } // namespace test 71 } // namespace test
66 } // namespace ios_web_view 72 } // namespace ios_web_view
OLDNEW
« no previous file with comments | « ios/web_view/test/web_view_test_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698