Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: ios/chrome/browser/ui/settings/clear_browsing_data_egtest.mm

Issue 2642193012: Make EarlGrey matchers compliant with Chromium style. (Closed)
Patch Set: build.gn and rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <XCTest/XCTest.h> 5 #import <XCTest/XCTest.h>
6 6
7 #include "components/strings/grit/components_strings.h" 7 #include "components/strings/grit/components_strings.h"
8 #import "ios/chrome/browser/ui/tools_menu/tools_menu_view_controller.h" 8 #import "ios/chrome/browser/ui/tools_menu/tools_menu_view_controller.h"
9 #include "ios/chrome/grit/ios_strings.h" 9 #include "ios/chrome/grit/ios_strings.h"
10 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" 10 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h"
11 #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h" 11 #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h"
12 #import "ios/chrome/test/earl_grey/chrome_matchers.h" 12 #import "ios/chrome/test/earl_grey/chrome_matchers.h"
13 #import "ios/chrome/test/earl_grey/chrome_test_case.h" 13 #import "ios/chrome/test/earl_grey/chrome_test_case.h"
14 #include "ui/base/l10n/l10n_util.h" 14 #include "ui/base/l10n/l10n_util.h"
15 15
16 using chrome_test_util::buttonWithAccessibilityLabel; 16 using chrome_test_util::ButtonWithAccessibilityLabel;
17 using chrome_test_util::buttonWithAccessibilityLabelId; 17 using chrome_test_util::ButtonWithAccessibilityLabelId;
18 18
19 @interface ClearBrowsingDataSettingsTestCase : ChromeTestCase 19 @interface ClearBrowsingDataSettingsTestCase : ChromeTestCase
20 @end 20 @end
21 21
22 @implementation ClearBrowsingDataSettingsTestCase 22 @implementation ClearBrowsingDataSettingsTestCase
23 23
24 - (void)openClearBrowsingDataDialog { 24 - (void)openClearBrowsingDataDialog {
25 [ChromeEarlGreyUI openToolsMenu]; 25 [ChromeEarlGreyUI openToolsMenu];
26 [[EarlGrey 26 [[EarlGrey
27 selectElementWithMatcher:grey_accessibilityID(kToolsMenuSettingsId)] 27 selectElementWithMatcher:grey_accessibilityID(kToolsMenuSettingsId)]
28 performAction:grey_tap()]; 28 performAction:grey_tap()];
29 NSString* settingsLabel = 29 NSString* settingsLabel =
30 l10n_util::GetNSString(IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY); 30 l10n_util::GetNSString(IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY);
31 [[EarlGrey 31 [[EarlGrey
32 selectElementWithMatcher:buttonWithAccessibilityLabel(settingsLabel)] 32 selectElementWithMatcher:ButtonWithAccessibilityLabel(settingsLabel)]
33 performAction:grey_tap()]; 33 performAction:grey_tap()];
34 34
35 NSString* clearBrowsingDataDialogLabel = 35 NSString* clearBrowsingDataDialogLabel =
36 l10n_util::GetNSString(IDS_IOS_CLEAR_BROWSING_DATA_TITLE); 36 l10n_util::GetNSString(IDS_IOS_CLEAR_BROWSING_DATA_TITLE);
37 [[EarlGrey selectElementWithMatcher:buttonWithAccessibilityLabel( 37 [[EarlGrey selectElementWithMatcher:ButtonWithAccessibilityLabel(
38 clearBrowsingDataDialogLabel)] 38 clearBrowsingDataDialogLabel)]
39 performAction:grey_tap()]; 39 performAction:grey_tap()];
40 } 40 }
41 41
42 - (void)exitSettingsMenu { 42 - (void)exitSettingsMenu {
43 [[EarlGrey selectElementWithMatcher:buttonWithAccessibilityLabelId( 43 [[EarlGrey selectElementWithMatcher:ButtonWithAccessibilityLabelId(
44 IDS_IOS_NAVIGATION_BAR_DONE_BUTTON)] 44 IDS_IOS_NAVIGATION_BAR_DONE_BUTTON)]
45 performAction:grey_tap()]; 45 performAction:grey_tap()];
46 // Wait for UI components to finish loading. 46 // Wait for UI components to finish loading.
47 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; 47 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
48 } 48 }
49 49
50 // Test that opening the clear browsing data dialog does not cause a crash. 50 // Test that opening the clear browsing data dialog does not cause a crash.
51 - (void)testOpeningClearBrowsingData { 51 - (void)testOpeningClearBrowsingData {
52 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; 52 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
53 NSString* oldSetting = 53 NSString* oldSetting =
54 [defaults stringForKey:@"EnableNewClearBrowsingDataUI"]; 54 [defaults stringForKey:@"EnableNewClearBrowsingDataUI"];
55 [defaults setObject:@"Enabled" forKey:@"EnableNewClearBrowsingDataUI"]; 55 [defaults setObject:@"Enabled" forKey:@"EnableNewClearBrowsingDataUI"];
56 56
57 [self openClearBrowsingDataDialog]; 57 [self openClearBrowsingDataDialog];
58 [self exitSettingsMenu]; 58 [self exitSettingsMenu];
59 59
60 [defaults setObject:oldSetting forKey:@"EnableNewClearBrowsingDataUI"]; 60 [defaults setObject:oldSetting forKey:@"EnableNewClearBrowsingDataUI"];
61 } 61 }
62 62
63 @end 63 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/settings/block_popups_egtest.mm ('k') | ios/chrome/browser/ui/settings/settings_egtest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698