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

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

Issue 2253233004: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 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/fake_video_renderer.cc ('k') | remoting/protocol/ice_transport_unittest.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 "remoting/base/url_request.h" 10 #include "remoting/base/url_request.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 void SetResult(const std::string& url, const UrlRequest::Result& result) { 46 void SetResult(const std::string& url, const UrlRequest::Result& result) {
47 results_[url] = result; 47 results_[url] = result;
48 } 48 }
49 49
50 // UrlRequestFactory interface. 50 // UrlRequestFactory interface.
51 std::unique_ptr<UrlRequest> CreateUrlRequest( 51 std::unique_ptr<UrlRequest> CreateUrlRequest(
52 UrlRequest::Type type, 52 UrlRequest::Type type,
53 const std::string& url) override { 53 const std::string& url) override {
54 EXPECT_EQ(UrlRequest::Type::POST, type); 54 EXPECT_EQ(UrlRequest::Type::POST, type);
55 CHECK(results_.count(url)); 55 CHECK(results_.count(url));
56 return base::WrapUnique(new FakeUrlRequest(results_[url])); 56 return base::MakeUnique<FakeUrlRequest>(results_[url]);
57 } 57 }
58 58
59 std::map<std::string, UrlRequest::Result> results_; 59 std::map<std::string, UrlRequest::Result> results_;
60 }; 60 };
61 61
62 } // namespace 62 } // namespace
63 63
64 static const char kTestUrl[] = "http://host/ice_config"; 64 static const char kTestUrl[] = "http://host/ice_config";
65 65
66 class HttpIceConfigRequestTest : public testing::Test { 66 class HttpIceConfigRequestTest : public testing::Test {
67 public: 67 public:
68 void OnResult(const IceConfig& config) { 68 void OnResult(const IceConfig& config) {
69 received_config_ = base::WrapUnique(new IceConfig(config)); 69 received_config_ = base::MakeUnique<IceConfig>(config);
70 } 70 }
71 71
72 protected: 72 protected:
73 FakeUrlRequestFactory url_request_factory_; 73 FakeUrlRequestFactory url_request_factory_;
74 std::unique_ptr<HttpIceConfigRequest> request_; 74 std::unique_ptr<HttpIceConfigRequest> request_;
75 std::unique_ptr<IceConfig> received_config_; 75 std::unique_ptr<IceConfig> received_config_;
76 }; 76 };
77 77
78 TEST_F(HttpIceConfigRequestTest, Parse) { 78 TEST_F(HttpIceConfigRequestTest, Parse) {
79 const char kTestResponse[] = 79 const char kTestResponse[] =
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 TEST_F(HttpIceConfigRequestTest, FailedRequest) { 187 TEST_F(HttpIceConfigRequestTest, FailedRequest) {
188 url_request_factory_.SetResult(kTestUrl, UrlRequest::Result::Failed()); 188 url_request_factory_.SetResult(kTestUrl, UrlRequest::Result::Failed());
189 request_.reset(new HttpIceConfigRequest(&url_request_factory_, kTestUrl)); 189 request_.reset(new HttpIceConfigRequest(&url_request_factory_, kTestUrl));
190 request_->Send( 190 request_->Send(
191 base::Bind(&HttpIceConfigRequestTest::OnResult, base::Unretained(this))); 191 base::Bind(&HttpIceConfigRequestTest::OnResult, base::Unretained(this)));
192 EXPECT_TRUE(received_config_->is_null()); 192 EXPECT_TRUE(received_config_->is_null());
193 } 193 }
194 194
195 } // namespace protocol 195 } // namespace protocol
196 } // namespace remoting 196 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/fake_video_renderer.cc ('k') | remoting/protocol/ice_transport_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698