| 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 #include "ios/testing/earl_grey/wait_util.h" | 9 #include "ios/testing/earl_grey/wait_util.h" |
| 10 #import "ios/web/public/web_state/web_state.h" | 10 #import "ios/web/public/web_state/web_state.h" |
| 11 #import "ios/web/public/test/earl_grey/web_view_matchers.h" | 11 #import "ios/web/public/test/earl_grey/web_view_matchers.h" |
| 12 #import "ios/web/shell/test/app/web_shell_test_util.h" | 12 #import "ios/web/shell/test/app/web_shell_test_util.h" |
| 13 #import "ios/web/shell/view_controller.h" | 13 #import "ios/web/shell/view_controller.h" |
| 14 | 14 |
| 15 namespace web { | 15 namespace web { |
| 16 | 16 |
| 17 id<GREYMatcher> webViewContainingText(std::string text) { | 17 id<GREYMatcher> webViewContainingText(std::string text) { |
| 18 WebState* web_state = shell_test_util::GetCurrentWebState(); | 18 WebState* web_state = shell_test_util::GetCurrentWebState(); |
| 19 return webViewContainingText(std::move(text), web_state); | 19 return webViewContainingText(std::move(text), web_state); |
| 20 } | 20 } |
| 21 | 21 |
| 22 id<GREYMatcher> webViewCssSelector(std::string selector) { | 22 id<GREYMatcher> webViewCssSelector(std::string selector) { |
| 23 WebState* web_state = shell_test_util::GetCurrentWebState(); | 23 WebState* web_state = shell_test_util::GetCurrentWebState(); |
| 24 return webViewCssSelector(std::move(selector), web_state); | 24 return webViewCssSelector(std::move(selector), web_state); |
| 25 } | 25 } |
| 26 | 26 |
| 27 id<GREYMatcher> webView() { |
| 28 return webViewInWebState(shell_test_util::GetCurrentWebState()); |
| 29 } |
| 30 |
| 27 id<GREYMatcher> webViewScrollView() { | 31 id<GREYMatcher> webViewScrollView() { |
| 28 return webViewScrollView(shell_test_util::GetCurrentWebState()); | 32 return webViewScrollView(shell_test_util::GetCurrentWebState()); |
| 29 } | 33 } |
| 30 | 34 |
| 31 id<GREYMatcher> addressFieldText(std::string text) { | 35 id<GREYMatcher> addressFieldText(std::string text) { |
| 32 MatchesBlock matches = ^BOOL(UIView* view) { | 36 MatchesBlock matches = ^BOOL(UIView* view) { |
| 33 if (![view isKindOfClass:[UITextField class]]) { | 37 if (![view isKindOfClass:[UITextField class]]) { |
| 34 return NO; | 38 return NO; |
| 35 } | 39 } |
| 36 if (![[view accessibilityLabel] | 40 if (![[view accessibilityLabel] |
| (...skipping 23 matching lines...) Expand all Loading... |
| 60 | 64 |
| 61 id<GREYMatcher> forwardButton() { | 65 id<GREYMatcher> forwardButton() { |
| 62 return grey_accessibilityLabel(kWebShellForwardButtonAccessibilityLabel); | 66 return grey_accessibilityLabel(kWebShellForwardButtonAccessibilityLabel); |
| 63 } | 67 } |
| 64 | 68 |
| 65 id<GREYMatcher> addressField() { | 69 id<GREYMatcher> addressField() { |
| 66 return grey_accessibilityLabel(kWebShellAddressFieldAccessibilityLabel); | 70 return grey_accessibilityLabel(kWebShellAddressFieldAccessibilityLabel); |
| 67 } | 71 } |
| 68 | 72 |
| 69 } // namespace web | 73 } // namespace web |
| OLD | NEW |