| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 site_instance_ = content::SiteInstance::Create(&profile_); | 61 site_instance_ = content::SiteInstance::Create(&profile_); |
| 62 web_contents_.reset(content::WebContents::Create( | 62 web_contents_.reset(content::WebContents::Create( |
| 63 content::WebContents::CreateParams(&profile_, site_instance_.get()))); | 63 content::WebContents::CreateParams(&profile_, site_instance_.get()))); |
| 64 web_ui_.set_web_contents(web_contents_.get()); | 64 web_ui_.set_web_contents(web_contents_.get()); |
| 65 fake_extractor_ = new FakeExtractor(); | 65 fake_extractor_ = new FakeExtractor(); |
| 66 handler_.reset(new TestableSyncInternalsMessageHandler( | 66 handler_.reset(new TestableSyncInternalsMessageHandler( |
| 67 &web_ui_, std::unique_ptr<FakeExtractor>(fake_extractor_))); | 67 &web_ui_, std::unique_ptr<FakeExtractor>(fake_extractor_))); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void ValidateAboutInfoCall() { | 70 void ValidateAboutInfoCall() { |
| 71 const ScopedVector<content::TestWebUI::CallData>& data_vector = | 71 const auto& data_vector = web_ui_.call_data(); |
| 72 web_ui_.call_data(); | |
| 73 ASSERT_FALSE(data_vector.empty()); | 72 ASSERT_FALSE(data_vector.empty()); |
| 74 EXPECT_EQ(1u, data_vector.size()); | 73 EXPECT_EQ(1u, data_vector.size()); |
| 75 | 74 |
| 76 const content::TestWebUI::CallData& call_data = *data_vector[0]; | 75 const content::TestWebUI::CallData& call_data = *data_vector[0]; |
| 77 | 76 |
| 78 EXPECT_EQ(syncer::sync_ui_util::kDispatchEvent, call_data.function_name()); | 77 EXPECT_EQ(syncer::sync_ui_util::kDispatchEvent, call_data.function_name()); |
| 79 | 78 |
| 80 const base::Value* arg1 = call_data.arg1(); | 79 const base::Value* arg1 = call_data.arg1(); |
| 81 ASSERT_TRUE(arg1); | 80 ASSERT_TRUE(arg1); |
| 82 std::string event_type; | 81 std::string event_type; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 } | 120 } |
| 122 | 121 |
| 123 TEST_F(SyncInternalsMessageHandlerTest, SendAboutInfoWithoutService) { | 122 TEST_F(SyncInternalsMessageHandlerTest, SendAboutInfoWithoutService) { |
| 124 base::CommandLine::ForCurrentProcess()->AppendSwitch(switches::kDisableSync); | 123 base::CommandLine::ForCurrentProcess()->AppendSwitch(switches::kDisableSync); |
| 125 handler()->OnStateChanged(); | 124 handler()->OnStateChanged(); |
| 126 EXPECT_EQ(1, fake_extractor()->call_count()); | 125 EXPECT_EQ(1, fake_extractor()->call_count()); |
| 127 EXPECT_EQ(nullptr, fake_extractor()->last_service()); | 126 EXPECT_EQ(nullptr, fake_extractor()->last_service()); |
| 128 EXPECT_EQ(nullptr, fake_extractor()->last_signin()); | 127 EXPECT_EQ(nullptr, fake_extractor()->last_signin()); |
| 129 ValidateAboutInfoCall(); | 128 ValidateAboutInfoCall(); |
| 130 } | 129 } |
| OLD | NEW |