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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 private: | 167 private: |
168 SyncService* sync_service() { return test_sync_service_.get(); } | 168 SyncService* sync_service() { return test_sync_service_.get(); } |
169 | 169 |
170 content::TestBrowserThreadBundle thread_bundle_; | 170 content::TestBrowserThreadBundle thread_bundle_; |
171 TestingProfile profile_; | 171 TestingProfile profile_; |
172 content::TestWebUI web_ui_; | 172 content::TestWebUI web_ui_; |
173 scoped_refptr<content::SiteInstance> site_instance_; | 173 scoped_refptr<content::SiteInstance> site_instance_; |
174 std::unique_ptr<content::WebContents> web_contents_; | 174 std::unique_ptr<content::WebContents> web_contents_; |
175 std::unique_ptr<TestSyncService> test_sync_service_; | 175 std::unique_ptr<TestSyncService> test_sync_service_; |
176 std::unique_ptr<TestableSyncInternalsMessageHandler> handler_; | 176 std::unique_ptr<TestableSyncInternalsMessageHandler> handler_; |
177 | |
178 int about_sync_data_delegate_call_count_ = 0; | 177 int about_sync_data_delegate_call_count_ = 0; |
179 SyncService* last_delegate_sync_service_ = nullptr; | 178 SyncService* last_delegate_sync_service_ = nullptr; |
180 }; | 179 }; |
181 | 180 |
182 TEST_F(SyncInternalsMessageHandlerTest, AddRemoveObservers) { | 181 TEST_F(SyncInternalsMessageHandlerTest, AddRemoveObservers) { |
183 ListValue empty_list; | 182 ListValue empty_list; |
184 | 183 |
185 EXPECT_EQ(0, test_sync_service()->add_observer_count()); | 184 EXPECT_EQ(0, test_sync_service()->add_observer_count()); |
186 handler()->HandleRegisterForEvents(&empty_list); | 185 handler()->HandleRegisterForEvents(&empty_list); |
187 EXPECT_EQ(1, test_sync_service()->add_observer_count()); | 186 EXPECT_EQ(1, test_sync_service()->add_observer_count()); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 ResetSyncService(); | 281 ResetSyncService(); |
283 | 282 |
284 handler()->AllowJavascriptForTesting(); | 283 handler()->AllowJavascriptForTesting(); |
285 handler()->OnStateChanged(nullptr); | 284 handler()->OnStateChanged(nullptr); |
286 EXPECT_EQ(1, about_sync_data_delegate_call_count()); | 285 EXPECT_EQ(1, about_sync_data_delegate_call_count()); |
287 EXPECT_EQ(nullptr, last_delegate_sync_service()); | 286 EXPECT_EQ(nullptr, last_delegate_sync_service()); |
288 ValidateAboutInfoCall(); | 287 ValidateAboutInfoCall(); |
289 } | 288 } |
290 | 289 |
291 } // namespace | 290 } // namespace |
OLD | NEW |