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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 std::unique_ptr<SyncInternalsMessageHandler> handler_; | 105 std::unique_ptr<SyncInternalsMessageHandler> handler_; |
106 | 106 |
107 // Non-owning pointer to the about information the handler uses. This | 107 // Non-owning pointer to the about information the handler uses. This |
108 // extractor is owned by the handler. | 108 // extractor is owned by the handler. |
109 FakeExtractor* fake_extractor_; | 109 FakeExtractor* fake_extractor_; |
110 }; | 110 }; |
111 | 111 |
112 } // namespace | 112 } // namespace |
113 | 113 |
114 TEST_F(SyncInternalsMessageHandlerTest, SendAboutInfoWithService) { | 114 TEST_F(SyncInternalsMessageHandlerTest, SendAboutInfoWithService) { |
115 handler()->OnStateChanged(); | 115 handler()->OnStateChanged(nullptr); |
116 EXPECT_EQ(1, fake_extractor()->call_count()); | 116 EXPECT_EQ(1, fake_extractor()->call_count()); |
117 EXPECT_NE(nullptr, fake_extractor()->last_service()); | 117 EXPECT_NE(nullptr, fake_extractor()->last_service()); |
118 EXPECT_NE(nullptr, fake_extractor()->last_signin()); | 118 EXPECT_NE(nullptr, fake_extractor()->last_signin()); |
119 ValidateAboutInfoCall(); | 119 ValidateAboutInfoCall(); |
120 } | 120 } |
121 | 121 |
122 TEST_F(SyncInternalsMessageHandlerTest, SendAboutInfoWithoutService) { | 122 TEST_F(SyncInternalsMessageHandlerTest, SendAboutInfoWithoutService) { |
123 base::CommandLine::ForCurrentProcess()->AppendSwitch(switches::kDisableSync); | 123 base::CommandLine::ForCurrentProcess()->AppendSwitch(switches::kDisableSync); |
124 handler()->OnStateChanged(); | 124 handler()->OnStateChanged(nullptr); |
125 EXPECT_EQ(1, fake_extractor()->call_count()); | 125 EXPECT_EQ(1, fake_extractor()->call_count()); |
126 EXPECT_EQ(nullptr, fake_extractor()->last_service()); | 126 EXPECT_EQ(nullptr, fake_extractor()->last_service()); |
127 EXPECT_EQ(nullptr, fake_extractor()->last_signin()); | 127 EXPECT_EQ(nullptr, fake_extractor()->last_signin()); |
128 ValidateAboutInfoCall(); | 128 ValidateAboutInfoCall(); |
129 } | 129 } |
OLD | NEW |