Chromium Code Reviews| 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 #include "ios/testing/earl_grey/wait_util.h" | 10 #include "ios/testing/earl_grey/wait_util.h" |
| 10 #import "ios/web/public/web_state/web_state.h" | 11 #import "ios/web/public/web_state/web_state.h" |
| 11 #import "ios/web/public/test/earl_grey/web_view_matchers.h" | 12 #import "ios/web/public/test/earl_grey/web_view_matchers.h" |
| 12 #import "ios/web/shell/test/app/web_shell_test_util.h" | 13 #import "ios/web/shell/test/app/web_shell_test_util.h" |
| 13 #import "ios/web/shell/view_controller.h" | 14 #import "ios/web/shell/view_controller.h" |
| 14 | 15 |
| 15 namespace web { | 16 namespace web { |
| 16 | 17 |
| 17 id<GREYMatcher> webViewContainingText(std::string text) { | 18 id<GREYMatcher> webViewContainingText(const std::string& text) { |
| 18 WebState* web_state = shell_test_util::GetCurrentWebState(); | 19 WebState* web_state = shell_test_util::GetCurrentWebState(); |
| 19 return webViewContainingText(std::move(text), web_state); | 20 return webViewContainingText(std::move(text), web_state); |
| 20 } | 21 } |
| 21 | 22 |
| 22 id<GREYMatcher> webViewCssSelector(std::string selector) { | 23 id<GREYMatcher> webViewCssSelector(const std::string& selector) { |
| 23 WebState* web_state = shell_test_util::GetCurrentWebState(); | 24 WebState* web_state = shell_test_util::GetCurrentWebState(); |
| 24 return webViewCssSelector(std::move(selector), web_state); | 25 return webViewCssSelector(std::move(selector), web_state); |
| 25 } | 26 } |
| 26 | 27 |
| 28 id<GREYMatcher> webView() { | |
| 29 return webViewInWebState(shell_test_util::GetCurrentWebState()); | |
| 30 } | |
| 31 | |
| 27 id<GREYMatcher> webViewScrollView() { | 32 id<GREYMatcher> webViewScrollView() { |
| 28 return webViewScrollView(shell_test_util::GetCurrentWebState()); | 33 return webViewScrollView(shell_test_util::GetCurrentWebState()); |
| 29 } | 34 } |
| 30 | 35 |
| 31 id<GREYMatcher> addressFieldText(std::string text) { | 36 id<GREYMatcher> addressFieldText(const std::string& text) { |
|
Eugene But (OOO till 7-30)
2016/08/31 15:27:59
This is going to break tests
| |
| 32 MatchesBlock matches = ^BOOL(UIView* view) { | 37 MatchesBlock matches = ^BOOL(UIView* view) { |
| 33 if (![view isKindOfClass:[UITextField class]]) { | 38 if (![view isKindOfClass:[UITextField class]]) { |
| 34 return NO; | 39 return NO; |
| 35 } | 40 } |
| 36 if (![[view accessibilityLabel] | 41 if (![[view accessibilityLabel] |
| 37 isEqualToString:kWebShellAddressFieldAccessibilityLabel]) { | 42 isEqualToString:kWebShellAddressFieldAccessibilityLabel]) { |
| 38 return NO; | 43 return NO; |
| 39 } | 44 } |
| 40 UITextField* text_field = base::mac::ObjCCastStrict<UITextField>(view); | 45 UITextField* text_field = base::mac::ObjCCastStrict<UITextField>(view); |
| 41 testing::WaitUntilCondition(testing::kWaitForUIElementTimeout, ^bool() { | 46 testing::WaitUntilCondition(testing::kWaitForUIElementTimeout, ^bool() { |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 60 | 65 |
| 61 id<GREYMatcher> forwardButton() { | 66 id<GREYMatcher> forwardButton() { |
| 62 return grey_accessibilityLabel(kWebShellForwardButtonAccessibilityLabel); | 67 return grey_accessibilityLabel(kWebShellForwardButtonAccessibilityLabel); |
| 63 } | 68 } |
| 64 | 69 |
| 65 id<GREYMatcher> addressField() { | 70 id<GREYMatcher> addressField() { |
| 66 return grey_accessibilityLabel(kWebShellAddressFieldAccessibilityLabel); | 71 return grey_accessibilityLabel(kWebShellAddressFieldAccessibilityLabel); |
| 67 } | 72 } |
| 68 | 73 |
| 69 } // namespace web | 74 } // namespace web |
| OLD | NEW |