| 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 <EarlGrey/EarlGrey.h> | 5 #import <EarlGrey/EarlGrey.h> |
| 6 #import <XCTest/XCTest.h> | 6 #import <XCTest/XCTest.h> |
| 7 | 7 |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #include "components/bookmarks/browser/bookmark_model.h" | 9 #include "components/bookmarks/browser/bookmark_model.h" |
| 10 #include "components/bookmarks/browser/titled_url_match.h" | 10 #include "components/bookmarks/browser/titled_url_match.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 grey_allOf(grey_accessibilityID(kSettingsSignInCellId), | 68 grey_allOf(grey_accessibilityID(kSettingsSignInCellId), |
| 69 grey_sufficientlyVisible(), nil); | 69 grey_sufficientlyVisible(), nil); |
| 70 [[EarlGrey selectElementWithMatcher:matcher] performAction:grey_tap()]; | 70 [[EarlGrey selectElementWithMatcher:matcher] performAction:grey_tap()]; |
| 71 } | 71 } |
| 72 | 72 |
| 73 // Signs in the identity for the specific |userEmail|. This is performed via the | 73 // Signs in the identity for the specific |userEmail|. This is performed via the |
| 74 // UI and must be called from the NTP. | 74 // UI and must be called from the NTP. |
| 75 void SignInIdentity(NSString* userEmail) { | 75 void SignInIdentity(NSString* userEmail) { |
| 76 OpenSignInFromSettings(); | 76 OpenSignInFromSettings(); |
| 77 [[EarlGrey | 77 [[EarlGrey |
| 78 selectElementWithMatcher:chrome_test_util::buttonWithAccessibilityLabel( | 78 selectElementWithMatcher:chrome_test_util::ButtonWithAccessibilityLabel( |
| 79 userEmail)] performAction:grey_tap()]; | 79 userEmail)] performAction:grey_tap()]; |
| 80 [[EarlGrey selectElementWithMatcher: | 80 [[EarlGrey selectElementWithMatcher: |
| 81 chrome_test_util::buttonWithAccessibilityLabelId( | 81 chrome_test_util::ButtonWithAccessibilityLabelId( |
| 82 IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SIGNIN_BUTTON)] | 82 IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SIGNIN_BUTTON)] |
| 83 performAction:grey_tap()]; | 83 performAction:grey_tap()]; |
| 84 [[EarlGrey selectElementWithMatcher: | 84 [[EarlGrey selectElementWithMatcher: |
| 85 chrome_test_util::buttonWithAccessibilityLabelId( | 85 chrome_test_util::ButtonWithAccessibilityLabelId( |
| 86 IDS_IOS_ACCOUNT_CONSISTENCY_CONFIRMATION_OK_BUTTON)] | 86 IDS_IOS_ACCOUNT_CONSISTENCY_CONFIRMATION_OK_BUTTON)] |
| 87 performAction:grey_tap()]; | 87 performAction:grey_tap()]; |
| 88 [[EarlGrey | 88 [[EarlGrey |
| 89 selectElementWithMatcher:chrome_test_util::buttonWithAccessibilityLabelId( | 89 selectElementWithMatcher:chrome_test_util::ButtonWithAccessibilityLabelId( |
| 90 IDS_DONE)] performAction:grey_tap()]; | 90 IDS_DONE)] performAction:grey_tap()]; |
| 91 } | 91 } |
| 92 | 92 |
| 93 // Waits for sync to be initialized or not, based on |isSyncInitialized| and | 93 // Waits for sync to be initialized or not, based on |isSyncInitialized| and |
| 94 // fails with a GREYAssert if that condition is never met. | 94 // fails with a GREYAssert if that condition is never met. |
| 95 void AssertSyncInitialized(bool is_initialized) { | 95 void AssertSyncInitialized(bool is_initialized) { |
| 96 ConditionBlock condition = ^{ | 96 ConditionBlock condition = ^{ |
| 97 return chrome_test_util::IsSyncInitialized() == is_initialized; | 97 return chrome_test_util::IsSyncInitialized() == is_initialized; |
| 98 }; | 98 }; |
| 99 GREYAssert( | 99 GREYAssert( |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 | 628 |
| 629 // Verify the correct number of bookmarks exist. | 629 // Verify the correct number of bookmarks exist. |
| 630 base::string16 matchString = base::SysNSStringToUTF16(title); | 630 base::string16 matchString = base::SysNSStringToUTF16(title); |
| 631 std::vector<bookmarks::TitledUrlMatch> matches; | 631 std::vector<bookmarks::TitledUrlMatch> matches; |
| 632 bookmarkModel->GetBookmarksMatching(matchString, 50, &matches); | 632 bookmarkModel->GetBookmarksMatching(matchString, 50, &matches); |
| 633 const size_t count = matches.size(); | 633 const size_t count = matches.size(); |
| 634 GREYAssertEqual(expectedCount, count, @"Unexpected number of bookmarks"); | 634 GREYAssertEqual(expectedCount, count, @"Unexpected number of bookmarks"); |
| 635 } | 635 } |
| 636 | 636 |
| 637 @end | 637 @end |
| OLD | NEW |