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 "chrome/browser/ui/webui/sync_internals_message_handler.h" | 5 #include "chrome/browser/ui/webui/sync_internals_message_handler.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 private: | 178 private: |
179 SyncService* sync_service() { return test_sync_service_.get(); } | 179 SyncService* sync_service() { return test_sync_service_.get(); } |
180 | 180 |
181 content::TestBrowserThreadBundle thread_bundle_; | 181 content::TestBrowserThreadBundle thread_bundle_; |
182 TestingProfile profile_; | 182 TestingProfile profile_; |
183 content::TestWebUI web_ui_; | 183 content::TestWebUI web_ui_; |
184 scoped_refptr<content::SiteInstance> site_instance_; | 184 scoped_refptr<content::SiteInstance> site_instance_; |
185 std::unique_ptr<content::WebContents> web_contents_; | 185 std::unique_ptr<content::WebContents> web_contents_; |
186 std::unique_ptr<TestSyncService> test_sync_service_; | 186 std::unique_ptr<TestSyncService> test_sync_service_; |
187 std::unique_ptr<TestableSyncInternalsMessageHandler> handler_; | 187 std::unique_ptr<TestableSyncInternalsMessageHandler> handler_; |
188 | |
189 int about_sync_data_delegate_call_count_ = 0; | 188 int about_sync_data_delegate_call_count_ = 0; |
190 SyncService* last_delegate_sync_service_ = nullptr; | 189 SyncService* last_delegate_sync_service_ = nullptr; |
191 }; | 190 }; |
192 | 191 |
193 TEST_F(SyncInternalsMessageHandlerTest, AddRemoveObservers) { | 192 TEST_F(SyncInternalsMessageHandlerTest, AddRemoveObservers) { |
194 ListValue empty_list; | 193 ListValue empty_list; |
195 | 194 |
196 EXPECT_EQ(0, test_sync_service()->add_observer_count()); | 195 EXPECT_EQ(0, test_sync_service()->add_observer_count()); |
197 handler()->HandleRegisterForEvents(&empty_list); | 196 handler()->HandleRegisterForEvents(&empty_list); |
198 EXPECT_EQ(1, test_sync_service()->add_observer_count()); | 197 EXPECT_EQ(1, test_sync_service()->add_observer_count()); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 ResetSyncService(); | 304 ResetSyncService(); |
306 | 305 |
307 handler()->AllowJavascriptForTesting(); | 306 handler()->AllowJavascriptForTesting(); |
308 handler()->OnStateChanged(nullptr); | 307 handler()->OnStateChanged(nullptr); |
309 EXPECT_EQ(1, about_sync_data_delegate_call_count()); | 308 EXPECT_EQ(1, about_sync_data_delegate_call_count()); |
310 EXPECT_EQ(nullptr, last_delegate_sync_service()); | 309 EXPECT_EQ(nullptr, last_delegate_sync_service()); |
311 ValidateAboutInfoCall(); | 310 ValidateAboutInfoCall(); |
312 } | 311 } |
313 | 312 |
314 } // namespace | 313 } // namespace |
OLD | NEW |