| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/profile_resetter/profile_resetter.h" | 9 #include "chrome/browser/profile_resetter/profile_resetter.h" |
| 10 #include "chrome/browser/ui/webui/settings/reset_settings_handler.h" | 10 #include "chrome/browser/ui/webui/settings/reset_settings_handler.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 private: | 79 private: |
| 80 // The order here matters. | 80 // The order here matters. |
| 81 content::TestBrowserThreadBundle thread_bundle_; | 81 content::TestBrowserThreadBundle thread_bundle_; |
| 82 TestingProfile profile_; | 82 TestingProfile profile_; |
| 83 content::TestWebUI web_ui_; | 83 content::TestWebUI web_ui_; |
| 84 TestingResetSettingsHandler handler_; | 84 TestingResetSettingsHandler handler_; |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 TEST_F(ResetSettingsHandlerTest, HandleResetProfileSettings) { | 87 TEST_F(ResetSettingsHandlerTest, HandleResetProfileSettings) { |
| 88 base::ListValue list; | 88 base::ListValue list; |
| 89 std::string expected_callback_id("dummyCallbackId"); |
| 90 list.AppendString(expected_callback_id); |
| 89 list.AppendBoolean(false); | 91 list.AppendBoolean(false); |
| 90 handler()->HandleResetProfileSettings(&list); | 92 handler()->HandleResetProfileSettings(&list); |
| 91 // Check that the delegate ProfileResetter was called. | 93 // Check that the delegate ProfileResetter was called. |
| 92 EXPECT_EQ(1u, handler()->resets()); | 94 EXPECT_EQ(1u, handler()->resets()); |
| 93 // Check that Javascript side is notified after resetting is done. | 95 // Check that Javascript side is notified after resetting is done. |
| 94 EXPECT_EQ("SettingsResetPage.doneResetting", | 96 EXPECT_EQ("cr.webUIResponse", |
| 95 web_ui()->call_data()[0]->function_name()); | 97 web_ui()->call_data()[0]->function_name()); |
| 98 std::string callback_id; |
| 99 EXPECT_TRUE(web_ui()->call_data()[0]->arg1()->GetAsString(&callback_id)); |
| 100 EXPECT_EQ(expected_callback_id, callback_id); |
| 96 } | 101 } |
| 97 | 102 |
| 98 } // namespace | 103 } // namespace |
| OLD | NEW |