| OLD | NEW |
| 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" |
| 9 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" | 11 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/webui/options/options_ui_browsertest.h" | 14 #include "chrome/browser/ui/webui/options/options_ui_browsertest.h" |
| 13 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
| 14 #include "components/prefs/pref_service.h" | 16 #include "components/prefs/pref_service.h" |
| 15 #include "content/public/test/browser_test_utils.h" | 17 #include "content/public/test/browser_test_utils.h" |
| 16 | 18 |
| 17 namespace options { | 19 namespace options { |
| 18 | 20 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 #define MAYBE_CommitButtonDisabledWhileDeletionInProgress \ | 52 #define MAYBE_CommitButtonDisabledWhileDeletionInProgress \ |
| 51 DISABLED_CommitButtonDisabledWhileDeletionInProgress | 53 DISABLED_CommitButtonDisabledWhileDeletionInProgress |
| 52 #else | 54 #else |
| 53 #define MAYBE_CommitButtonDisabledWhileDeletionInProgress \ | 55 #define MAYBE_CommitButtonDisabledWhileDeletionInProgress \ |
| 54 CommitButtonDisabledWhileDeletionInProgress | 56 CommitButtonDisabledWhileDeletionInProgress |
| 55 #endif | 57 #endif |
| 56 | 58 |
| 57 IN_PROC_BROWSER_TEST_F(ClearBrowserDataBrowserTest, | 59 IN_PROC_BROWSER_TEST_F(ClearBrowserDataBrowserTest, |
| 58 MAYBE_CommitButtonDisabledWhileDeletionInProgress) { | 60 MAYBE_CommitButtonDisabledWhileDeletionInProgress) { |
| 59 const char kCommitButtonId[] = "#clear-browser-data-commit"; | 61 const char kCommitButtonId[] = "#clear-browser-data-commit"; |
| 60 BrowsingDataRemoverCompletionInhibitor completion_inhibitor; | 62 BrowsingDataRemoverCompletionInhibitor completion_inhibitor( |
| 63 BrowsingDataRemoverFactory::GetForBrowserContext(browser()->profile())); |
| 61 | 64 |
| 62 // Navigate to the Clear Browsing Data dialog to ensure that the commit button | 65 // Navigate to the Clear Browsing Data dialog to ensure that the commit button |
| 63 // is initially enabled, usable, and gets disabled after having been pressed. | 66 // is initially enabled, usable, and gets disabled after having been pressed. |
| 64 NavigateToSettingsSubpage(chrome::kClearBrowserDataSubPage); | 67 NavigateToSettingsSubpage(chrome::kClearBrowserDataSubPage); |
| 65 ASSERT_NO_FATAL_FAILURE(ClickElement(kCommitButtonId)); | 68 ASSERT_NO_FATAL_FAILURE(ClickElement(kCommitButtonId)); |
| 66 EXPECT_FALSE(IsElementEnabled(kCommitButtonId)); | 69 EXPECT_FALSE(IsElementEnabled(kCommitButtonId)); |
| 67 | 70 |
| 68 completion_inhibitor.BlockUntilNearCompletion(); | 71 completion_inhibitor.BlockUntilNearCompletion(); |
| 69 | 72 |
| 70 // Simulate a reload while the previous removal is still running, and verify | 73 // Simulate a reload while the previous removal is still running, and verify |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // However, expect the commit button to be re-enabled if any of the data types | 107 // However, expect the commit button to be re-enabled if any of the data types |
| 105 // gets selected to be cleared. | 108 // gets selected to be cleared. |
| 106 for (size_t i = 0; i < arraysize(kDataTypes); ++i) { | 109 for (size_t i = 0; i < arraysize(kDataTypes); ++i) { |
| 107 prefs->SetBoolean(kDataTypes[i], true); | 110 prefs->SetBoolean(kDataTypes[i], true); |
| 108 EXPECT_TRUE(IsElementEnabled(kCommitButtonId)); | 111 EXPECT_TRUE(IsElementEnabled(kCommitButtonId)); |
| 109 prefs->SetBoolean(kDataTypes[i], false); | 112 prefs->SetBoolean(kDataTypes[i], false); |
| 110 } | 113 } |
| 111 } | 114 } |
| 112 | 115 |
| 113 } // namespace options | 116 } // namespace options |
| OLD | NEW |