OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/gcm_driver/gcm_driver.h" | 5 #include "components/gcm_driver/gcm_driver_desktop.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
12 #include "base/message_loop/message_loop_proxy.h" | 12 #include "base/message_loop/message_loop_proxy.h" |
13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "base/test/test_simple_task_runner.h" | 15 #include "base/test/test_simple_task_runner.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 } | 183 } |
184 | 184 |
185 FakeGCMClient* GCMDriverTest::GetGCMClient() { | 185 FakeGCMClient* GCMDriverTest::GetGCMClient() { |
186 return static_cast<FakeGCMClient*>(driver_->GetGCMClientForTesting()); | 186 return static_cast<FakeGCMClient*>(driver_->GetGCMClientForTesting()); |
187 } | 187 } |
188 | 188 |
189 void GCMDriverTest::CreateDriver( | 189 void GCMDriverTest::CreateDriver( |
190 FakeGCMClient::StartMode gcm_client_start_mode) { | 190 FakeGCMClient::StartMode gcm_client_start_mode) { |
191 scoped_refptr<net::URLRequestContextGetter> request_context = | 191 scoped_refptr<net::URLRequestContextGetter> request_context = |
192 new net::TestURLRequestContextGetter(io_thread_.message_loop_proxy()); | 192 new net::TestURLRequestContextGetter(io_thread_.message_loop_proxy()); |
193 driver_.reset(new GCMDriver( | 193 // TODO(johnme): Need equivalent test coverage of GCMDriverAndroid. |
| 194 driver_.reset(new GCMDriverDesktop( |
194 scoped_ptr<GCMClientFactory>(new FakeGCMClientFactory( | 195 scoped_ptr<GCMClientFactory>(new FakeGCMClientFactory( |
195 gcm_client_start_mode, | 196 gcm_client_start_mode, |
196 base::MessageLoopProxy::current(), | 197 base::MessageLoopProxy::current(), |
197 io_thread_.message_loop_proxy())).Pass(), | 198 io_thread_.message_loop_proxy())).Pass(), |
198 identity_provider_owner_.PassAs<IdentityProvider>(), | 199 identity_provider_owner_.PassAs<IdentityProvider>(), |
199 GCMClient::ChromeBuildInfo(), | 200 GCMClient::ChromeBuildInfo(), |
200 temp_dir_.path(), | 201 temp_dir_.path(), |
201 request_context, | 202 request_context, |
202 base::MessageLoopProxy::current(), | 203 base::MessageLoopProxy::current(), |
203 io_thread_.message_loop_proxy(), | 204 io_thread_.message_loop_proxy(), |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 | 892 |
892 TEST_F(GCMDriverFunctionalTest, MessagesDeleted) { | 893 TEST_F(GCMDriverFunctionalTest, MessagesDeleted) { |
893 GetGCMClient()->DeleteMessages(kTestAppID1); | 894 GetGCMClient()->DeleteMessages(kTestAppID1); |
894 gcm_app_handler()->WaitForNotification(); | 895 gcm_app_handler()->WaitForNotification(); |
895 EXPECT_EQ(FakeGCMAppHandler::MESSAGES_DELETED_EVENT, | 896 EXPECT_EQ(FakeGCMAppHandler::MESSAGES_DELETED_EVENT, |
896 gcm_app_handler()->received_event()); | 897 gcm_app_handler()->received_event()); |
897 EXPECT_EQ(kTestAppID1, gcm_app_handler()->app_id()); | 898 EXPECT_EQ(kTestAppID1, gcm_app_handler()->app_id()); |
898 } | 899 } |
899 | 900 |
900 } // namespace gcm | 901 } // namespace gcm |
OLD | NEW |