Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: components/gcm_driver/gcm_channel_status_request.cc

Issue 659393003: [GCM] DCHECK should not be used since it will skip the code inside (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Add test Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_channel_status_request.h" 5 #include "components/gcm_driver/gcm_channel_status_request.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "components/gcm_driver/gcm_backoff_policy.h" 9 #include "components/gcm_driver/gcm_backoff_policy.h"
10 #include "net/base/escape.h" 10 #include "net/base/escape.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } 53 }
54 54
55 void GCMChannelStatusRequest::Start() { 55 void GCMChannelStatusRequest::Start() {
56 DCHECK(!url_fetcher_.get()); 56 DCHECK(!url_fetcher_.get());
57 57
58 GURL request_url(channel_status_request_url_); 58 GURL request_url(channel_status_request_url_);
59 59
60 sync_pb::ExperimentStatusRequest proto_data; 60 sync_pb::ExperimentStatusRequest proto_data;
61 proto_data.add_experiment_name(kGCMChannelTag); 61 proto_data.add_experiment_name(kGCMChannelTag);
62 std::string upload_data; 62 std::string upload_data;
63 DCHECK(proto_data.SerializeToString(&upload_data)); 63 if (!proto_data.SerializeToString(&upload_data)) {
64 NOTREACHED();
65 }
64 66
65 url_fetcher_.reset( 67 url_fetcher_.reset(
66 net::URLFetcher::Create(request_url, net::URLFetcher::POST, this)); 68 net::URLFetcher::Create(request_url, net::URLFetcher::POST, this));
67 url_fetcher_->SetRequestContext(request_context_getter_.get()); 69 url_fetcher_->SetRequestContext(request_context_getter_.get());
68 url_fetcher_->AddExtraRequestHeader("User-Agent: " + user_agent_); 70 url_fetcher_->AddExtraRequestHeader("User-Agent: " + user_agent_);
69 url_fetcher_->SetUploadData(kRequestContentType, upload_data); 71 url_fetcher_->SetUploadData(kRequestContentType, upload_data);
70 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 72 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
71 net::LOAD_DO_NOT_SAVE_COOKIES); 73 net::LOAD_DO_NOT_SAVE_COOKIES);
72 url_fetcher_->Start(); 74 url_fetcher_->Start();
73 } 75 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 weak_ptr_factory_.GetWeakPtr(), 148 weak_ptr_factory_.GetWeakPtr(),
147 false), 149 false),
148 backoff_entry_.GetTimeUntilRelease()); 150 backoff_entry_.GetTimeUntilRelease());
149 return; 151 return;
150 } 152 }
151 153
152 Start(); 154 Start();
153 } 155 }
154 156
155 } // namespace gcm 157 } // namespace gcm
OLDNEW
« no previous file with comments | « components/gcm_driver/gcm_channel_status_request.h ('k') | components/gcm_driver/gcm_channel_status_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698