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 <EarlGrey/EarlGrey.h> | 5 #import <EarlGrey/EarlGrey.h> |
| 6 #import <UIKit/UIKit.h> | 6 #import <UIKit/UIKit.h> |
| 7 #import <XCTest/XCTest.h> | 7 #import <XCTest/XCTest.h> |
| 8 | 8 |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "components/browsing_data/core/pref_names.h" | 10 #include "components/browsing_data/core/pref_names.h" |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 468 assertWithMatcher:grey_notNil()]; | 468 assertWithMatcher:grey_notNil()]; |
| 469 | 469 |
| 470 [ChromeEarlGrey loadURL:_URL3]; | 470 [ChromeEarlGrey loadURL:_URL3]; |
| 471 id<GREYMatcher> response3Matcher = | 471 id<GREYMatcher> response3Matcher = |
| 472 chrome_test_util::WebViewContainingText(kResponse3); | 472 chrome_test_util::WebViewContainingText(kResponse3); |
| 473 [[EarlGrey selectElementWithMatcher:response3Matcher] | 473 [[EarlGrey selectElementWithMatcher:response3Matcher] |
| 474 assertWithMatcher:grey_notNil()]; | 474 assertWithMatcher:grey_notNil()]; |
| 475 } | 475 } |
| 476 | 476 |
| 477 - (void)openHistoryPanel { | 477 - (void)openHistoryPanel { |
| 478 // TODO:(crbug.com/685570) Fix the tap instead of adding a delay. | |
|
lpromero
2017/01/26 10:15:53
The style if "// TODO(crbug.com/685570): Fix…"
gambard
2017/01/26 10:29:54
Done.
| |
| 479 GREYCondition* myCondition = [GREYCondition | |
| 480 conditionWithName:@"Delay to ensure the toolbar menu can be opened" | |
| 481 block:^BOOL { | |
| 482 return NO; | |
| 483 }]; | |
| 484 [myCondition waitWithTimeout:0.5]; | |
|
lpromero
2017/01/26 10:17:07
How many tests do we have? Adding 0.5 seconds to a
gambard
2017/01/26 10:19:04
I will add them to the failing tests only. There i
| |
| 485 | |
| 478 [ChromeEarlGreyUI openToolsMenu]; | 486 [ChromeEarlGreyUI openToolsMenu]; |
| 479 [[EarlGrey selectElementWithMatcher:HistoryButton()] | 487 [[EarlGrey selectElementWithMatcher:HistoryButton()] |
| 480 performAction:grey_tap()]; | 488 performAction:grey_tap()]; |
| 481 } | 489 } |
| 482 | 490 |
| 483 - (void)assertNoHistoryShown { | 491 - (void)assertNoHistoryShown { |
| 484 id<GREYMatcher> noHistoryMessageMatcher = | 492 id<GREYMatcher> noHistoryMessageMatcher = |
| 485 grey_allOf(grey_text(l10n_util::GetNSString(IDS_HISTORY_NO_RESULTS)), | 493 grey_allOf(grey_text(l10n_util::GetNSString(IDS_HISTORY_NO_RESULTS)), |
| 486 grey_sufficientlyVisible(), nil); | 494 grey_sufficientlyVisible(), nil); |
| 487 [[EarlGrey selectElementWithMatcher:noHistoryMessageMatcher] | 495 [[EarlGrey selectElementWithMatcher:noHistoryMessageMatcher] |
| 488 assertWithMatcher:grey_notNil()]; | 496 assertWithMatcher:grey_notNil()]; |
| 489 | 497 |
| 490 id<GREYMatcher> historyEntryMatcher = | 498 id<GREYMatcher> historyEntryMatcher = |
| 491 grey_allOf(grey_kindOfClass([HistoryEntryCell class]), | 499 grey_allOf(grey_kindOfClass([HistoryEntryCell class]), |
| 492 grey_sufficientlyVisible(), nil); | 500 grey_sufficientlyVisible(), nil); |
| 493 [[EarlGrey selectElementWithMatcher:historyEntryMatcher] | 501 [[EarlGrey selectElementWithMatcher:historyEntryMatcher] |
| 494 assertWithMatcher:grey_nil()]; | 502 assertWithMatcher:grey_nil()]; |
| 495 } | 503 } |
| 496 | 504 |
| 497 - (void)resetBrowsingDataPrefs { | 505 - (void)resetBrowsingDataPrefs { |
| 498 PrefService* prefs = chrome_test_util::GetOriginalBrowserState()->GetPrefs(); | 506 PrefService* prefs = chrome_test_util::GetOriginalBrowserState()->GetPrefs(); |
| 499 prefs->ClearPref(browsing_data::prefs::kDeleteBrowsingHistory); | 507 prefs->ClearPref(browsing_data::prefs::kDeleteBrowsingHistory); |
| 500 prefs->ClearPref(browsing_data::prefs::kDeleteCookies); | 508 prefs->ClearPref(browsing_data::prefs::kDeleteCookies); |
| 501 prefs->ClearPref(browsing_data::prefs::kDeleteCache); | 509 prefs->ClearPref(browsing_data::prefs::kDeleteCache); |
| 502 prefs->ClearPref(browsing_data::prefs::kDeletePasswords); | 510 prefs->ClearPref(browsing_data::prefs::kDeletePasswords); |
| 503 prefs->ClearPref(browsing_data::prefs::kDeleteFormData); | 511 prefs->ClearPref(browsing_data::prefs::kDeleteFormData); |
| 504 } | 512 } |
| 505 | 513 |
| 506 @end | 514 @end |
| OLD | NEW |