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 "base/message_loop/message_loop.h" | |
6 #include "components/gcm_driver/gcm_channel_status_request.h" | 5 #include "components/gcm_driver/gcm_channel_status_request.h" |
7 #include "net/url_request/test_url_fetcher_factory.h" | 6 #include "net/url_request/test_url_fetcher_factory.h" |
8 #include "net/url_request/url_request_test_util.h" | 7 #include "net/url_request/url_request_test_util.h" |
9 #include "sync/protocol/experiment_status.pb.h" | 8 #include "sync/protocol/experiment_status.pb.h" |
10 #include "sync/protocol/experiments_specifics.pb.h" | 9 #include "sync/protocol/experiments_specifics.pb.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
12 | 11 |
13 namespace gcm { | 12 namespace gcm { |
14 | 13 |
15 class GCMChannelStatusRequestTest : public testing::Test { | 14 class GCMChannelStatusRequestTest : public testing::Test { |
(...skipping 21 matching lines...) Expand all Loading... |
37 base::MessageLoop message_loop_; | 36 base::MessageLoop message_loop_; |
38 net::TestURLFetcherFactory url_fetcher_factory_; | 37 net::TestURLFetcherFactory url_fetcher_factory_; |
39 scoped_refptr<net::TestURLRequestContextGetter> url_request_context_getter_; | 38 scoped_refptr<net::TestURLRequestContextGetter> url_request_context_getter_; |
40 bool request_callback_invoked_; | 39 bool request_callback_invoked_; |
41 bool update_received_; | 40 bool update_received_; |
42 bool enabled_; | 41 bool enabled_; |
43 int poll_interval_seconds_; | 42 int poll_interval_seconds_; |
44 }; | 43 }; |
45 | 44 |
46 GCMChannelStatusRequestTest::GCMChannelStatusRequestTest() | 45 GCMChannelStatusRequestTest::GCMChannelStatusRequestTest() |
47 : url_request_context_getter_(new net::TestURLRequestContextGetter( | 46 : url_request_context_getter_( |
48 message_loop_.message_loop_proxy())), | 47 new net::TestURLRequestContextGetter(message_loop_.task_runner())), |
49 request_callback_invoked_(false), | 48 request_callback_invoked_(false), |
50 update_received_(false), | 49 update_received_(false), |
51 enabled_(true), | 50 enabled_(true), |
52 poll_interval_seconds_(0) { | 51 poll_interval_seconds_(0) { |
53 } | 52 } |
54 | 53 |
55 GCMChannelStatusRequestTest::~GCMChannelStatusRequestTest() { | 54 GCMChannelStatusRequestTest::~GCMChannelStatusRequestTest() { |
56 } | 55 } |
57 | 56 |
58 void GCMChannelStatusRequestTest::StartRequest() { | 57 void GCMChannelStatusRequestTest::StartRequest() { |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 SetResponseProtoData(GCM_DISABLED, poll_interval_seconds); | 229 SetResponseProtoData(GCM_DISABLED, poll_interval_seconds); |
231 CompleteFetch(); | 230 CompleteFetch(); |
232 | 231 |
233 EXPECT_TRUE(request_callback_invoked_); | 232 EXPECT_TRUE(request_callback_invoked_); |
234 EXPECT_TRUE(update_received_); | 233 EXPECT_TRUE(update_received_); |
235 EXPECT_FALSE(enabled_); | 234 EXPECT_FALSE(enabled_); |
236 EXPECT_EQ(poll_interval_seconds, poll_interval_seconds_); | 235 EXPECT_EQ(poll_interval_seconds, poll_interval_seconds_); |
237 } | 236 } |
238 | 237 |
239 } // namespace gcm | 238 } // namespace gcm |
OLD | NEW |