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

Side by Side Diff: webrtc/p2p/quic/quicconnectionhelper_unittest.cc

Issue 1923163003: Replace scoped_ptr with unique_ptr in webrtc/p2p/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 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 | « webrtc/p2p/client/portallocator_unittest.cc ('k') | webrtc/p2p/quic/quicsession.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include <memory>
12
11 #include "webrtc/p2p/quic/quicconnectionhelper.h" 13 #include "webrtc/p2p/quic/quicconnectionhelper.h"
12 14
13 #include "net/quic/quic_time.h" 15 #include "net/quic/quic_time.h"
14 #include "webrtc/base/gunit.h" 16 #include "webrtc/base/gunit.h"
15 #include "webrtc/base/scoped_ptr.h"
16 17
17 using cricket::QuicAlarm; 18 using cricket::QuicAlarm;
18 using cricket::QuicConnectionHelper; 19 using cricket::QuicConnectionHelper;
19 20
20 using net::QuicClock; 21 using net::QuicClock;
21 using net::QuicTime; 22 using net::QuicTime;
22 using net::QuicWallTime; 23 using net::QuicWallTime;
23 24
24 // Clock that can be set to arbitrary times. 25 // Clock that can be set to arbitrary times.
25 class MockClock : public QuicClock { 26 class MockClock : public QuicClock {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 83
83 // Make rtc::Thread::Current() process the next message. 84 // Make rtc::Thread::Current() process the next message.
84 void ProcessNextMessage() { rtc::Thread::Current()->ProcessMessages(0); } 85 void ProcessNextMessage() { rtc::Thread::Current()->ProcessMessages(0); }
85 86
86 protected: 87 protected:
87 // Handles event that alarm fires. 88 // Handles event that alarm fires.
88 MockAlarmDelegate* delegate_; 89 MockAlarmDelegate* delegate_;
89 // Used for setting clock time relative to alarm. 90 // Used for setting clock time relative to alarm.
90 MockClock clock_; 91 MockClock clock_;
91 92
92 rtc::scoped_ptr<QuicAlarm> alarm_; 93 std::unique_ptr<QuicAlarm> alarm_;
93 }; 94 };
94 95
95 // Test that the alarm is fired. 96 // Test that the alarm is fired.
96 TEST_F(QuicAlarmTest, FireAlarm) { 97 TEST_F(QuicAlarmTest, FireAlarm) {
97 SetTime(-1); 98 SetTime(-1);
98 ProcessNextMessage(); 99 ProcessNextMessage();
99 ASSERT_TRUE(delegate_->fired()); 100 ASSERT_TRUE(delegate_->fired());
100 ASSERT_EQ(QuicTime::Zero(), alarm_->deadline()); 101 ASSERT_EQ(QuicTime::Zero(), alarm_->deadline());
101 } 102 }
102 103
(...skipping 15 matching lines...) Expand all
118 ASSERT_FALSE(delegate_->fired()); 119 ASSERT_FALSE(delegate_->fired());
119 } 120 }
120 121
121 // Test that timing for posting task is accurate. 122 // Test that timing for posting task is accurate.
122 TEST_F(QuicAlarmTest, AlarmGetDelay) { 123 TEST_F(QuicAlarmTest, AlarmGetDelay) {
123 SetTime(1000000); 124 SetTime(1000000);
124 EXPECT_EQ(1000, alarm_->GetDelay()); 125 EXPECT_EQ(1000, alarm_->GetDelay());
125 clock_.AdvanceTime(QuicTime::Delta::FromMicroseconds(300000)); 126 clock_.AdvanceTime(QuicTime::Delta::FromMicroseconds(300000));
126 EXPECT_EQ(700, alarm_->GetDelay()); 127 EXPECT_EQ(700, alarm_->GetDelay());
127 } 128 }
OLDNEW
« no previous file with comments | « webrtc/p2p/client/portallocator_unittest.cc ('k') | webrtc/p2p/quic/quicsession.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698