Commit fdee479f authored by sczs's avatar sczs Committed by Commit Bot

[ios] Adds resetBrowsingDataPrefs to ChromeEarlGrey.

-This CL is part of the history_ui_egtest migration, in which
resetBrowsingDataPrefs used to live.

-Cleans up un-used imports and DEPS from history_ui_egtest.

Change-Id: Ie3683213564d22659a9118761206582f71ee502f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1976154Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#726512}
parent ceed9200
......@@ -147,37 +147,19 @@ source_set("eg_tests") {
]
deps = [
":constants",
":history",
":history_ui",
"//base",
"//components/browsing_data/core",
"//components/prefs",
"//components/strings",
"//components/url_formatter:url_formatter",
"//ios/chrome/app/strings",
"//ios/chrome/browser",
"//ios/chrome/browser/browser_state",
"//ios/chrome/browser/ui/authentication:eg_test_support",
"//ios/chrome/browser/ui/authentication/cells",
"//ios/chrome/browser/ui/popup_menu:constants",
"//ios/chrome/browser/ui/settings",
"//ios/chrome/browser/ui/settings/cells",
"//ios/chrome/browser/ui/table_view",
"//ios/chrome/browser/ui/table_view:feature_flags",
"//ios/chrome/browser/ui/table_view/cells",
"//ios/chrome/browser/ui/util",
"//ios/chrome/common",
"//ios/chrome/test/app:test_support",
"//ios/chrome/test/earl_grey:test_support",
"//ios/public/provider/chrome/browser/signin",
"//ios/public/provider/chrome/browser/signin:fake_chrome_identity",
"//ios/public/provider/chrome/browser/signin:test_support",
"//ios/third_party/earl_grey:earl_grey+link",
"//ios/web/public/test",
"//ios/web/public/test/http_server",
"//net",
"//net:test_support",
"//ui/base",
]
libs = [
"UIKit.framework",
......
......@@ -10,36 +10,20 @@
#include "base/strings/stringprintf.h"
#include "base/strings/sys_string_conversions.h"
#import "base/test/ios/wait_util.h"
#include "components/browsing_data/core/pref_names.h"
#include "components/prefs/pref_service.h"
#include "components/strings/grit/components_strings.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/chrome_url_constants.h"
#import "ios/chrome/browser/ui/authentication/cells/signin_promo_view.h"
#import "ios/chrome/browser/ui/authentication/signin_earlgrey_utils.h"
#import "ios/chrome/browser/ui/history/history_ui_constants.h"
#import "ios/chrome/browser/ui/popup_menu/popup_menu_constants.h"
#import "ios/chrome/browser/ui/settings/cells/clear_browsing_data_constants.h"
#import "ios/chrome/browser/ui/settings/settings_table_view_controller.h"
#import "ios/chrome/browser/ui/table_view/cells/table_view_url_item.h"
#import "ios/chrome/browser/ui/table_view/feature_flags.h"
#import "ios/chrome/browser/ui/table_view/table_view_navigation_controller_constants.h"
#import "ios/chrome/browser/ui/util/transparent_link_button.h"
#include "ios/chrome/browser/ui/util/ui_util.h"
#include "ios/chrome/common/string_util.h"
#include "ios/chrome/grit/ios_strings.h"
#import "ios/chrome/test/app/chrome_test_util.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"
#import "ios/public/provider/chrome/browser/signin/chrome_identity.h"
#import "ios/public/provider/chrome/browser/signin/fake_chrome_identity.h"
#import "ios/public/provider/chrome/browser/signin/fake_chrome_identity_service.h"
#import "ios/web/public/test/http_server/http_server.h"
#import "ios/web/public/test/http_server/http_server_util.h"
#import "net/base/mac/url_conversions.h"
#include "ui/base/l10n/l10n_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
......@@ -123,8 +107,6 @@ id<GREYMatcher> OpenInNewIncognitoTabButton() {
- (void)loadTestURLs;
// Displays the history UI.
- (void)openHistoryPanel;
// Resets which data is selected in the Clear Browsing Data UI.
- (void)resetBrowsingDataPrefs;
@end
......@@ -152,7 +134,7 @@ id<GREYMatcher> OpenInNewIncognitoTabButton() {
[ChromeEarlGrey clearBrowsingHistory];
// Some tests rely on a clean state for the "Clear Browsing Data" settings
// screen.
[self resetBrowsingDataPrefs];
[ChromeEarlGrey resetBrowsingDataPrefs];
}
- (void)tearDown {
......@@ -169,7 +151,7 @@ id<GREYMatcher> OpenInNewIncognitoTabButton() {
// Some tests change the default values for the "Clear Browsing Data" settings
// screen.
[self resetBrowsingDataPrefs];
[ChromeEarlGrey resetBrowsingDataPrefs];
[super tearDown];
}
......@@ -533,13 +515,4 @@ id<GREYMatcher> OpenInNewIncognitoTabButton() {
[ChromeEarlGreyUI tapToolsMenuButton:HistoryButton()];
}
- (void)resetBrowsingDataPrefs {
PrefService* prefs = chrome_test_util::GetOriginalBrowserState()->GetPrefs();
prefs->ClearPref(browsing_data::prefs::kDeleteBrowsingHistory);
prefs->ClearPref(browsing_data::prefs::kDeleteCookies);
prefs->ClearPref(browsing_data::prefs::kDeleteCache);
prefs->ClearPref(browsing_data::prefs::kDeletePasswords);
prefs->ClearPref(browsing_data::prefs::kDeleteFormData);
}
@end
......@@ -222,6 +222,7 @@ source_set("test_support") {
"//base",
"//base/test:test_support",
"//components/autofill/core/browser",
"//components/browsing_data/core",
"//components/content_settings/core/browser",
"//components/payments/core:core",
"//components/strings",
......@@ -232,6 +233,7 @@ source_set("test_support") {
"//ios/chrome/app:app_internal",
"//ios/chrome/app/strings",
"//ios/chrome/browser/autofill",
"//ios/chrome/browser/browser_state",
"//ios/chrome/browser/content_settings:content_settings",
"//ios/chrome/browser/ntp:features",
"//ios/chrome/browser/passwords",
......@@ -354,6 +356,7 @@ source_set("eg_app_support+eg2") {
"//base",
"//base/test:test_support",
"//components/autofill/core/browser",
"//components/browsing_data/core",
"//components/content_settings/core/browser",
"//components/payments/core:core",
"//components/strings",
......@@ -365,6 +368,7 @@ source_set("eg_app_support+eg2") {
"//ios/chrome/app/strings",
"//ios/chrome/browser/autofill",
"//ios/chrome/browser/autofill/automation:eg_app_support+eg2",
"//ios/chrome/browser/browser_state",
"//ios/chrome/browser/content_settings:content_settings",
"//ios/chrome/browser/device_sharing:eg_app_support+eg2",
"//ios/chrome/browser/find_in_page",
......
......@@ -479,6 +479,10 @@ id ExecuteJavaScript(NSString* javascript, NSError* __autoreleasing* out_error);
// Sets the value of a boolean user pref in the original browser state.
- (void)setBoolValue:(BOOL)value forUserPref:(const std::string&)UTF8PrefName;
// Resets the BrowsingDataPrefs, which defines if its selected or not when
// clearing Browsing data.
- (void)resetBrowsingDataPrefs;
@end
// Helpers that only compile under EarlGrey 1 are included in this "EG1"
......
......@@ -802,6 +802,10 @@ GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ChromeEarlGreyAppInterface)
return [ChromeEarlGreyAppInterface setBoolValue:value forUserPref:prefName];
}
- (void)resetBrowsingDataPrefs {
return [ChromeEarlGreyAppInterface resetBrowsingDataPrefs];
}
@end
// The helpers below only compile under EarlGrey1.
......
......@@ -383,6 +383,10 @@
// Sets the value of a boolean user pref in the original browser state.
+ (void)setBoolValue:(BOOL)value forUserPref:(NSString*)prefName;
// Resets the BrowsingDataPrefs, which defines if its selected or not when
// clearing Browsing data.
+ (void)resetBrowsingDataPrefs;
#pragma mark - Keyboard Command utilities
// The count of key commands registered with the currently active BVC.
......
......@@ -8,11 +8,14 @@
#include "base/strings/sys_string_conversions.h"
#include "components/autofill/core/browser/personal_data_manager.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/browsing_data/core/pref_names.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#import "components/payments/core/features.h"
#include "components/prefs/pref_service.h"
#import "components/ukm/ios/features.h"
#import "ios/chrome/app/main_controller.h"
#include "ios/chrome/browser/autofill/personal_data_manager_factory.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/content_settings/host_content_settings_map_factory.h"
#import "ios/chrome/browser/ntp/features.h"
#import "ios/chrome/browser/ui/settings/autofill/features.h"
......@@ -656,6 +659,15 @@ using chrome_test_util::BrowserCommandDispatcherForMainBVC;
base::SysNSStringToUTF8(prefName).c_str(), value);
}
+ (void)resetBrowsingDataPrefs {
PrefService* prefs = chrome_test_util::GetOriginalBrowserState()->GetPrefs();
prefs->ClearPref(browsing_data::prefs::kDeleteBrowsingHistory);
prefs->ClearPref(browsing_data::prefs::kDeleteCookies);
prefs->ClearPref(browsing_data::prefs::kDeleteCache);
prefs->ClearPref(browsing_data::prefs::kDeletePasswords);
prefs->ClearPref(browsing_data::prefs::kDeleteFormData);
}
#pragma mark - Keyboard Command Utilities
+ (NSInteger)registeredKeyCommandCount {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment