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

Unified Diff: ios/chrome/browser/ui/settings/clear_browsing_data_egtest.mm

Issue 2589583003: Upstream Chrome on iOS source code [7/11]. (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/settings/clear_browsing_data_egtest.mm
diff --git a/ios/chrome/browser/ui/settings/clear_browsing_data_egtest.mm b/ios/chrome/browser/ui/settings/clear_browsing_data_egtest.mm
new file mode 100644
index 0000000000000000000000000000000000000000..16cef66f4200041a2f372f3b1d2b93e36e0d85b2
--- /dev/null
+++ b/ios/chrome/browser/ui/settings/clear_browsing_data_egtest.mm
@@ -0,0 +1,63 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import <XCTest/XCTest.h>
+
+#include "components/strings/grit/components_strings.h"
+#import "ios/chrome/browser/ui/tools_menu/tools_menu_view_controller.h"
+#include "ios/chrome/grit/ios_strings.h"
+#import "ios/chrome/test/earl_grey/chrome_earl_grey.h"
+#import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h"
+#import "ios/chrome/test/earl_grey/chrome_matchers.h"
+#import "ios/chrome/test/earl_grey/chrome_test_case.h"
+#include "ui/base/l10n/l10n_util.h"
+
+using chrome_test_util::buttonWithAccessibilityLabel;
+using chrome_test_util::buttonWithAccessibilityLabelId;
+
+@interface ClearBrowsingDataSettingsTestCase : ChromeTestCase
+@end
+
+@implementation ClearBrowsingDataSettingsTestCase
+
+- (void)openClearBrowsingDataDialog {
+ [ChromeEarlGreyUI openToolsMenu];
+ [[EarlGrey
+ selectElementWithMatcher:grey_accessibilityID(kToolsMenuSettingsId)]
+ performAction:grey_tap()];
+ NSString* settingsLabel =
+ l10n_util::GetNSString(IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY);
+ [[EarlGrey
+ selectElementWithMatcher:buttonWithAccessibilityLabel(settingsLabel)]
+ performAction:grey_tap()];
+
+ NSString* clearBrowsingDataDialogLabel =
+ l10n_util::GetNSString(IDS_IOS_CLEAR_BROWSING_DATA_TITLE);
+ [[EarlGrey selectElementWithMatcher:buttonWithAccessibilityLabel(
+ clearBrowsingDataDialogLabel)]
+ performAction:grey_tap()];
+}
+
+- (void)exitSettingsMenu {
+ [[EarlGrey selectElementWithMatcher:buttonWithAccessibilityLabelId(
+ IDS_IOS_NAVIGATION_BAR_DONE_BUTTON)]
+ performAction:grey_tap()];
+ // Wait for UI components to finish loading.
+ [[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
+}
+
+// Test that opening the clear browsing data dialog does not cause a crash.
+- (void)testOpeningClearBrowsingData {
+ NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
+ NSString* oldSetting =
+ [defaults stringForKey:@"EnableNewClearBrowsingDataUI"];
+ [defaults setObject:@"Enabled" forKey:@"EnableNewClearBrowsingDataUI"];
+
+ [self openClearBrowsingDataDialog];
+ [self exitSettingsMenu];
+
+ [defaults setObject:oldSetting forKey:@"EnableNewClearBrowsingDataUI"];
+}
+
+@end

Powered by Google App Engine
This is Rietveld 408576698