| 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/shell/test/earl_grey/shell_matchers.h" | 5 #import "ios/web/shell/test/earl_grey/shell_matchers.h" |
| 6 | 6 |
| 7 #import "base/mac/foundation_util.h" | 7 #import "base/mac/foundation_util.h" |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #import "ios/testing/earl_grey/matchers.h" | 9 #import "ios/testing/earl_grey/matchers.h" |
| 10 #include "ios/testing/earl_grey/wait_util.h" | 10 #include "ios/testing/earl_grey/wait_util.h" |
| 11 #import "ios/web/public/web_state/web_state.h" | 11 #import "ios/web/public/web_state/web_state.h" |
| 12 #import "ios/web/public/test/earl_grey/web_view_matchers.h" | 12 #import "ios/web/public/test/earl_grey/web_view_matchers.h" |
| 13 #import "ios/web/shell/test/app/web_shell_test_util.h" | 13 #import "ios/web/shell/test/app/web_shell_test_util.h" |
| 14 #import "ios/web/shell/view_controller.h" | 14 #import "ios/web/shell/view_controller.h" |
| 15 | 15 |
| 16 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 17 #error "This file requires ARC support." |
| 18 #endif |
| 19 |
| 16 namespace web { | 20 namespace web { |
| 17 | 21 |
| 18 id<GREYMatcher> webViewContainingText(const std::string& text) { | 22 id<GREYMatcher> webViewContainingText(const std::string& text) { |
| 19 WebState* web_state = shell_test_util::GetCurrentWebState(); | 23 WebState* web_state = shell_test_util::GetCurrentWebState(); |
| 20 return webViewContainingText(std::move(text), web_state); | 24 return webViewContainingText(std::move(text), web_state); |
| 21 } | 25 } |
| 22 | 26 |
| 23 id<GREYMatcher> webViewCssSelector(const std::string& selector) { | 27 id<GREYMatcher> webViewCssSelector(const std::string& selector) { |
| 24 WebState* web_state = shell_test_util::GetCurrentWebState(); | 28 WebState* web_state = shell_test_util::GetCurrentWebState(); |
| 25 return webViewCssSelector(std::move(selector), web_state); | 29 return webViewCssSelector(std::move(selector), web_state); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 47 return [text_field.text isEqualToString:base::SysUTF8ToNSString(text)]; | 51 return [text_field.text isEqualToString:base::SysUTF8ToNSString(text)]; |
| 48 }); | 52 }); |
| 49 return YES; | 53 return YES; |
| 50 }; | 54 }; |
| 51 | 55 |
| 52 DescribeToBlock describe = ^(id<GREYDescription> description) { | 56 DescribeToBlock describe = ^(id<GREYDescription> description) { |
| 53 [description appendText:@"address field containing "]; | 57 [description appendText:@"address field containing "]; |
| 54 [description appendText:base::SysUTF8ToNSString(text)]; | 58 [description appendText:base::SysUTF8ToNSString(text)]; |
| 55 }; | 59 }; |
| 56 | 60 |
| 57 return [[[GREYElementMatcherBlock alloc] initWithMatchesBlock:matches | 61 return [[GREYElementMatcherBlock alloc] initWithMatchesBlock:matches |
| 58 descriptionBlock:describe] | 62 descriptionBlock:describe]; |
| 59 autorelease]; | |
| 60 } | 63 } |
| 61 | 64 |
| 62 id<GREYMatcher> backButton() { | 65 id<GREYMatcher> backButton() { |
| 63 return grey_accessibilityLabel(kWebShellBackButtonAccessibilityLabel); | 66 return grey_accessibilityLabel(kWebShellBackButtonAccessibilityLabel); |
| 64 } | 67 } |
| 65 | 68 |
| 66 id<GREYMatcher> forwardButton() { | 69 id<GREYMatcher> forwardButton() { |
| 67 return grey_accessibilityLabel(kWebShellForwardButtonAccessibilityLabel); | 70 return grey_accessibilityLabel(kWebShellForwardButtonAccessibilityLabel); |
| 68 } | 71 } |
| 69 | 72 |
| 70 id<GREYMatcher> addressField() { | 73 id<GREYMatcher> addressField() { |
| 71 return grey_accessibilityLabel(kWebShellAddressFieldAccessibilityLabel); | 74 return grey_accessibilityLabel(kWebShellAddressFieldAccessibilityLabel); |
| 72 } | 75 } |
| 73 | 76 |
| 74 } // namespace web | 77 } // namespace web |
| OLD | NEW |