| 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/google/google_brand.h" | 9 #include "chrome/browser/google/google_brand.h" |
| 10 #include "chrome/browser/profile_resetter/profile_resetter.h" | 10 #include "chrome/browser/profile_resetter/profile_resetter.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 TestingProfile profile_; | 85 TestingProfile profile_; |
| 86 content::TestWebUI web_ui_; | 86 content::TestWebUI web_ui_; |
| 87 std::unique_ptr<TestingResetSettingsHandler> handler_; | 87 std::unique_ptr<TestingResetSettingsHandler> handler_; |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 TEST_F(ResetSettingsHandlerTest, HandleResetProfileSettings) { | 90 TEST_F(ResetSettingsHandlerTest, HandleResetProfileSettings) { |
| 91 base::ListValue list; | 91 base::ListValue list; |
| 92 std::string expected_callback_id("dummyCallbackId"); | 92 std::string expected_callback_id("dummyCallbackId"); |
| 93 list.AppendString(expected_callback_id); | 93 list.AppendString(expected_callback_id); |
| 94 list.AppendBoolean(false); | 94 list.AppendBoolean(false); |
| 95 list.AppendString(""); |
| 95 handler()->HandleResetProfileSettings(&list); | 96 handler()->HandleResetProfileSettings(&list); |
| 96 // Check that the delegate ProfileResetter was called. | 97 // Check that the delegate ProfileResetter was called. |
| 97 EXPECT_EQ(1u, handler()->resets()); | 98 EXPECT_EQ(1u, handler()->resets()); |
| 98 // Check that Javascript side is notified after resetting is done. | 99 // Check that Javascript side is notified after resetting is done. |
| 99 EXPECT_EQ("cr.webUIResponse", | 100 EXPECT_EQ("cr.webUIResponse", |
| 100 web_ui()->call_data()[0]->function_name()); | 101 web_ui()->call_data()[0]->function_name()); |
| 101 std::string callback_id; | 102 std::string callback_id; |
| 102 EXPECT_TRUE(web_ui()->call_data()[0]->arg1()->GetAsString(&callback_id)); | 103 EXPECT_TRUE(web_ui()->call_data()[0]->arg1()->GetAsString(&callback_id)); |
| 103 EXPECT_EQ(expected_callback_id, callback_id); | 104 EXPECT_EQ(expected_callback_id, callback_id); |
| 104 } | 105 } |
| 105 | 106 |
| 106 } // namespace | 107 } // namespace |
| OLD | NEW |