| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <initializer_list> | 6 #include <initializer_list> |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 if (params.setting_to_reset == SettingType::STARTUP_PAGE) | 83 if (params.setting_to_reset == SettingType::STARTUP_PAGE) |
| 84 startup_urls_to_reset_ = startup_urls_; | 84 startup_urls_to_reset_ = startup_urls_; |
| 85 | 85 |
| 86 for (size_t i = 0; i < params.extensions_to_disable; ++i) { | 86 for (size_t i = 0; i < params.extensions_to_disable; ++i) { |
| 87 std::string id = "id" + base::IntToString(i); | 87 std::string id = "id" + base::IntToString(i); |
| 88 extensions_.insert( | 88 extensions_.insert( |
| 89 std::make_pair(id, safe_browsing::ExtensionInfo( | 89 std::make_pair(id, safe_browsing::ExtensionInfo( |
| 90 id, "Extension " + base::IntToString(i)))); | 90 id, "Extension " + base::IntToString(i)))); |
| 91 } | 91 } |
| 92 | 92 |
| 93 ON_CALL(*this, ShouldPromptForReset()).WillByDefault(Return(true)); |
| 93 ON_CALL(*this, PerformReset(_)).WillByDefault(Return()); | 94 ON_CALL(*this, PerformReset(_)).WillByDefault(Return()); |
| 94 | 95 ON_CALL(*this, DialogShown()).WillByDefault(Return()); |
| 95 ON_CALL(*this, ShouldPromptForReset()).WillByDefault(Return(true)); | |
| 96 | 96 |
| 97 ON_CALL(*this, homepage()).WillByDefault(Return(GURL(kHomepageUrl))); | 97 ON_CALL(*this, homepage()).WillByDefault(Return(GURL(kHomepageUrl))); |
| 98 ON_CALL(*this, homepage_reset_state()) | 98 ON_CALL(*this, homepage_reset_state()) |
| 99 .WillByDefault( | 99 .WillByDefault( |
| 100 Return(params.setting_to_reset == SettingType::HOMEPAGE | 100 Return(params.setting_to_reset == SettingType::HOMEPAGE |
| 101 ? RESET_REQUIRED | 101 ? RESET_REQUIRED |
| 102 : NO_RESET_REQUIRED_DUE_TO_DOMAIN_NOT_MATCHED)); | 102 : NO_RESET_REQUIRED_DUE_TO_DOMAIN_NOT_MATCHED)); |
| 103 | 103 |
| 104 ON_CALL(*this, default_search()).WillByDefault(Return(GURL(kSearchUrl))); | 104 ON_CALL(*this, default_search()).WillByDefault(Return(GURL(kSearchUrl))); |
| 105 ON_CALL(*this, default_search_reset_state()) | 105 ON_CALL(*this, default_search_reset_state()) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 117 ? RESET_REQUIRED | 117 ? RESET_REQUIRED |
| 118 : NO_RESET_REQUIRED_DUE_TO_DOMAIN_NOT_MATCHED)); | 118 : NO_RESET_REQUIRED_DUE_TO_DOMAIN_NOT_MATCHED)); |
| 119 | 119 |
| 120 ON_CALL(*this, extensions_to_disable()) | 120 ON_CALL(*this, extensions_to_disable()) |
| 121 .WillByDefault(ReturnRef(extensions_)); | 121 .WillByDefault(ReturnRef(extensions_)); |
| 122 } | 122 } |
| 123 ~MockSettingsResetPromptModel() override {} | 123 ~MockSettingsResetPromptModel() override {} |
| 124 | 124 |
| 125 MOCK_METHOD1(PerformReset, void(const base::Closure&)); | 125 MOCK_METHOD1(PerformReset, void(const base::Closure&)); |
| 126 MOCK_CONST_METHOD0(ShouldPromptForReset, bool()); | 126 MOCK_CONST_METHOD0(ShouldPromptForReset, bool()); |
| 127 MOCK_METHOD0(DialogShown, void()); |
| 127 MOCK_CONST_METHOD0(homepage, GURL()); | 128 MOCK_CONST_METHOD0(homepage, GURL()); |
| 128 MOCK_CONST_METHOD0(homepage_reset_state, ResetState()); | 129 MOCK_CONST_METHOD0(homepage_reset_state, ResetState()); |
| 129 MOCK_CONST_METHOD0(default_search, GURL()); | 130 MOCK_CONST_METHOD0(default_search, GURL()); |
| 130 MOCK_CONST_METHOD0(default_search_reset_state, ResetState()); | 131 MOCK_CONST_METHOD0(default_search_reset_state, ResetState()); |
| 131 MOCK_CONST_METHOD0(startup_urls, const std::vector<GURL>&()); | 132 MOCK_CONST_METHOD0(startup_urls, const std::vector<GURL>&()); |
| 132 MOCK_CONST_METHOD0(startup_urls_to_reset, const std::vector<GURL>&()); | 133 MOCK_CONST_METHOD0(startup_urls_to_reset, const std::vector<GURL>&()); |
| 133 MOCK_CONST_METHOD0(startup_urls_reset_state, ResetState()); | 134 MOCK_CONST_METHOD0(startup_urls_reset_state, ResetState()); |
| 134 MOCK_CONST_METHOD0(extensions_to_disable, const ExtensionMap&()); | 135 MOCK_CONST_METHOD0(extensions_to_disable, const ExtensionMap&()); |
| 135 | 136 |
| 136 private: | 137 private: |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 RunDialog(); | 201 RunDialog(); |
| 201 } | 202 } |
| 202 IN_PROC_BROWSER_TEST_F(SettingsResetPromptDialogTest, InvokeDialog_sp2_ext2) { | 203 IN_PROC_BROWSER_TEST_F(SettingsResetPromptDialogTest, InvokeDialog_sp2_ext2) { |
| 203 RunDialog(); | 204 RunDialog(); |
| 204 } | 205 } |
| 205 IN_PROC_BROWSER_TEST_F(SettingsResetPromptDialogTest, InvokeDialog_hp_ext2) { | 206 IN_PROC_BROWSER_TEST_F(SettingsResetPromptDialogTest, InvokeDialog_hp_ext2) { |
| 206 RunDialog(); | 207 RunDialog(); |
| 207 } | 208 } |
| 208 | 209 |
| 209 } // namespace | 210 } // namespace |
| OLD | NEW |