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" | 5 #include "base/message_loop/message_loop.h" |
6 #include "components/gcm_driver/gcm_channel_status_request.h" | 6 #include "components/gcm_driver/gcm_channel_status_request.h" |
7 #include "components/gcm_driver/proto/gcm_channel_status.pb.h" | 7 #include "components/gcm_driver/proto/gcm_channel_status.pb.h" |
8 #include "net/url_request/test_url_fetcher_factory.h" | 8 #include "net/url_request/test_url_fetcher_factory.h" |
9 #include "net/url_request/url_request_test_util.h" | 9 #include "net/url_request/url_request_test_util.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 enabled_(true), | 46 enabled_(true), |
47 poll_interval_seconds_(0) { | 47 poll_interval_seconds_(0) { |
48 } | 48 } |
49 | 49 |
50 GCMChannelStatusRequestTest::~GCMChannelStatusRequestTest() { | 50 GCMChannelStatusRequestTest::~GCMChannelStatusRequestTest() { |
51 } | 51 } |
52 | 52 |
53 void GCMChannelStatusRequestTest::StartRequest() { | 53 void GCMChannelStatusRequestTest::StartRequest() { |
54 request_.reset(new GCMChannelStatusRequest( | 54 request_.reset(new GCMChannelStatusRequest( |
55 url_request_context_getter_.get(), | 55 url_request_context_getter_.get(), |
| 56 "http://channel.status.request.com/", |
| 57 "user agent string", |
56 base::Bind(&GCMChannelStatusRequestTest::OnRequestCompleted, | 58 base::Bind(&GCMChannelStatusRequestTest::OnRequestCompleted, |
57 base::Unretained(this)))); | 59 base::Unretained(this)))); |
58 request_->Start(); | 60 request_->Start(); |
59 } | 61 } |
60 | 62 |
61 void GCMChannelStatusRequestTest::SetResponseStatusAndString( | 63 void GCMChannelStatusRequestTest::SetResponseStatusAndString( |
62 net::HttpStatusCode status_code, | 64 net::HttpStatusCode status_code, |
63 const std::string& response_body) { | 65 const std::string& response_body) { |
64 net::TestURLFetcher* fetcher = url_fetcher_factory_.GetFetcherByID(0); | 66 net::TestURLFetcher* fetcher = url_fetcher_factory_.GetFetcherByID(0); |
65 ASSERT_TRUE(fetcher); | 67 ASSERT_TRUE(fetcher); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 StartRequest(); | 189 StartRequest(); |
188 SetResponseProtoData(GCM_DISABLED, poll_interval_seconds); | 190 SetResponseProtoData(GCM_DISABLED, poll_interval_seconds); |
189 CompleteFetch(); | 191 CompleteFetch(); |
190 | 192 |
191 EXPECT_TRUE(request_callback_invoked_); | 193 EXPECT_TRUE(request_callback_invoked_); |
192 EXPECT_FALSE(enabled_); | 194 EXPECT_FALSE(enabled_); |
193 EXPECT_EQ(poll_interval_seconds, poll_interval_seconds_); | 195 EXPECT_EQ(poll_interval_seconds, poll_interval_seconds_); |
194 } | 196 } |
195 | 197 |
196 } // namespace gcm | 198 } // namespace gcm |
OLD | NEW |