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

Side by Side Diff: remoting/protocol/http_ice_config_request_unittest.cc

Issue 2729423003: Network traffic annotation added to chromium_url_request. (Closed)
Patch Set: Annotation updated. Created 3 years, 7 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
« no previous file with comments | « remoting/protocol/http_ice_config_request.cc ('k') | remoting/protocol/port_allocator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "remoting/protocol/http_ice_config_request.h" 5 #include "remoting/protocol/http_ice_config_request.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
10 #include "remoting/base/url_request.h" 11 #include "remoting/base/url_request.h"
11 #include "remoting/protocol/ice_config.h" 12 #include "remoting/protocol/ice_config.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 14
14 namespace remoting { 15 namespace remoting {
15 namespace protocol { 16 namespace protocol {
16 17
17 namespace { 18 namespace {
18 19
19 class FakeUrlRequest : public UrlRequest { 20 class FakeUrlRequest : public UrlRequest {
(...skipping 23 matching lines...) Expand all
43 FakeUrlRequestFactory() {} 44 FakeUrlRequestFactory() {}
44 ~FakeUrlRequestFactory() override {} 45 ~FakeUrlRequestFactory() override {}
45 46
46 void SetResult(const std::string& url, const UrlRequest::Result& result) { 47 void SetResult(const std::string& url, const UrlRequest::Result& result) {
47 results_[url] = result; 48 results_[url] = result;
48 } 49 }
49 50
50 // UrlRequestFactory interface. 51 // UrlRequestFactory interface.
51 std::unique_ptr<UrlRequest> CreateUrlRequest( 52 std::unique_ptr<UrlRequest> CreateUrlRequest(
52 UrlRequest::Type type, 53 UrlRequest::Type type,
53 const std::string& url) override { 54 const std::string& url,
55 const net::NetworkTrafficAnnotationTag& traffic_annotation) override {
54 EXPECT_EQ(UrlRequest::Type::POST, type); 56 EXPECT_EQ(UrlRequest::Type::POST, type);
55 CHECK(results_.count(url)); 57 CHECK(results_.count(url));
56 return base::MakeUnique<FakeUrlRequest>(results_[url]); 58 return base::MakeUnique<FakeUrlRequest>(results_[url]);
57 } 59 }
58 60
59 std::map<std::string, UrlRequest::Result> results_; 61 std::map<std::string, UrlRequest::Result> results_;
60 }; 62 };
61 63
62 } // namespace 64 } // namespace
63 65
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 TEST_F(HttpIceConfigRequestTest, FailedRequest) { 189 TEST_F(HttpIceConfigRequestTest, FailedRequest) {
188 url_request_factory_.SetResult(kTestUrl, UrlRequest::Result::Failed()); 190 url_request_factory_.SetResult(kTestUrl, UrlRequest::Result::Failed());
189 request_.reset(new HttpIceConfigRequest(&url_request_factory_, kTestUrl)); 191 request_.reset(new HttpIceConfigRequest(&url_request_factory_, kTestUrl));
190 request_->Send( 192 request_->Send(
191 base::Bind(&HttpIceConfigRequestTest::OnResult, base::Unretained(this))); 193 base::Bind(&HttpIceConfigRequestTest::OnResult, base::Unretained(this)));
192 EXPECT_TRUE(received_config_->is_null()); 194 EXPECT_TRUE(received_config_->is_null());
193 } 195 }
194 196
195 } // namespace protocol 197 } // namespace protocol
196 } // namespace remoting 198 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/http_ice_config_request.cc ('k') | remoting/protocol/port_allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698