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

Side by Side Diff: chrome/browser/ui/webui/options/clear_browser_data_browsertest.cc

Issue 2827523003: Move BrowsingDataRemover to content/ (Closed)
Patch Set: Addressed some comments. Created 3 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "chrome/browser/browsing_data/browsing_data_remover.h"
10 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h"
11 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h"
12 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/webui/options/options_ui_browsertest.h" 11 #include "chrome/browser/ui/webui/options/options_ui_browsertest.h"
15 #include "chrome/common/url_constants.h" 12 #include "chrome/common/url_constants.h"
16 #include "components/prefs/pref_service.h" 13 #include "components/prefs/pref_service.h"
14 #include "content/public/browser/browsing_data_remover.h"
17 #include "content/public/test/browser_test_utils.h" 15 #include "content/public/test/browser_test_utils.h"
16 #include "content/public/test/browsing_data_remover_test_util.h"
18 17
19 namespace options { 18 namespace options {
20 19
21 class ClearBrowserDataBrowserTest : public OptionsUIBrowserTest { 20 class ClearBrowserDataBrowserTest : public OptionsUIBrowserTest {
22 protected: 21 protected:
23 void ClickElement(const std::string& selector) { 22 void ClickElement(const std::string& selector) {
24 bool element_enabled = false; 23 bool element_enabled = false;
25 ASSERT_NO_FATAL_FAILURE(GetElementEnabledState(selector, &element_enabled)); 24 ASSERT_NO_FATAL_FAILURE(GetElementEnabledState(selector, &element_enabled));
26 ASSERT_TRUE(element_enabled); 25 ASSERT_TRUE(element_enabled);
27 ASSERT_TRUE(content::ExecuteScript( 26 ASSERT_TRUE(content::ExecuteScript(
(...skipping 24 matching lines...) Expand all
52 #define MAYBE_CommitButtonDisabledWhileDeletionInProgress \ 51 #define MAYBE_CommitButtonDisabledWhileDeletionInProgress \
53 DISABLED_CommitButtonDisabledWhileDeletionInProgress 52 DISABLED_CommitButtonDisabledWhileDeletionInProgress
54 #else 53 #else
55 #define MAYBE_CommitButtonDisabledWhileDeletionInProgress \ 54 #define MAYBE_CommitButtonDisabledWhileDeletionInProgress \
56 CommitButtonDisabledWhileDeletionInProgress 55 CommitButtonDisabledWhileDeletionInProgress
57 #endif 56 #endif
58 57
59 IN_PROC_BROWSER_TEST_F(ClearBrowserDataBrowserTest, 58 IN_PROC_BROWSER_TEST_F(ClearBrowserDataBrowserTest,
60 MAYBE_CommitButtonDisabledWhileDeletionInProgress) { 59 MAYBE_CommitButtonDisabledWhileDeletionInProgress) {
61 const char kCommitButtonId[] = "#clear-browser-data-commit"; 60 const char kCommitButtonId[] = "#clear-browser-data-commit";
62 BrowsingDataRemoverCompletionInhibitor completion_inhibitor( 61 content::BrowsingDataRemoverCompletionInhibitor completion_inhibitor(
63 BrowsingDataRemoverFactory::GetForBrowserContext(browser()->profile())); 62 content::BrowserContext::GetBrowsingDataRemover(browser()->profile()));
64 63
65 // Navigate to the Clear Browsing Data dialog to ensure that the commit button 64 // Navigate to the Clear Browsing Data dialog to ensure that the commit button
66 // is initially enabled, usable, and gets disabled after having been pressed. 65 // is initially enabled, usable, and gets disabled after having been pressed.
67 NavigateToSettingsSubpage(chrome::kClearBrowserDataSubPage); 66 NavigateToSettingsSubpage(chrome::kClearBrowserDataSubPage);
68 ASSERT_NO_FATAL_FAILURE(ClickElement(kCommitButtonId)); 67 ASSERT_NO_FATAL_FAILURE(ClickElement(kCommitButtonId));
69 EXPECT_FALSE(IsElementEnabled(kCommitButtonId)); 68 EXPECT_FALSE(IsElementEnabled(kCommitButtonId));
70 69
71 completion_inhibitor.BlockUntilNearCompletion(); 70 completion_inhibitor.BlockUntilNearCompletion();
72 71
73 // Simulate a reload while the previous removal is still running, and verify 72 // Simulate a reload while the previous removal is still running, and verify
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // However, expect the commit button to be re-enabled if any of the data types 106 // However, expect the commit button to be re-enabled if any of the data types
108 // gets selected to be cleared. 107 // gets selected to be cleared.
109 for (size_t i = 0; i < arraysize(kDataTypes); ++i) { 108 for (size_t i = 0; i < arraysize(kDataTypes); ++i) {
110 prefs->SetBoolean(kDataTypes[i], true); 109 prefs->SetBoolean(kDataTypes[i], true);
111 EXPECT_TRUE(IsElementEnabled(kCommitButtonId)); 110 EXPECT_TRUE(IsElementEnabled(kCommitButtonId));
112 prefs->SetBoolean(kDataTypes[i], false); 111 prefs->SetBoolean(kDataTypes[i], false);
113 } 112 }
114 } 113 }
115 114
116 } // namespace options 115 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698