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

Side by Side Diff: extensions/browser/api/cast_channel/keep_alive_delegate_unittest.cc

Issue 2688463003: [chrome.cast.channel] Remove event logging. (Closed)
Patch Set: Remove errors object when socket is closed Created 3 years, 10 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "extensions/browser/api/cast_channel/keep_alive_delegate.h" 5 #include "extensions/browser/api/cast_channel/keep_alive_delegate.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "base/test/simple_test_clock.h"
14 #include "base/timer/mock_timer.h" 13 #include "base/timer/mock_timer.h"
15 #include "extensions/browser/api/cast_channel/cast_test_util.h" 14 #include "extensions/browser/api/cast_channel/cast_test_util.h"
16 #include "net/base/net_errors.h" 15 #include "net/base/net_errors.h"
17 #include "testing/gmock/include/gmock/gmock.h" 16 #include "testing/gmock/include/gmock/gmock.h"
18 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
19 18
20 using testing::_; 19 using testing::_;
21 using testing::Sequence; 20 using testing::Sequence;
22 21
23 namespace extensions { 22 namespace extensions {
(...skipping 25 matching lines...) Expand all
49 }; 48 };
50 49
51 class KeepAliveDelegateTest : public testing::Test { 50 class KeepAliveDelegateTest : public testing::Test {
52 public: 51 public:
53 KeepAliveDelegateTest() {} 52 KeepAliveDelegateTest() {}
54 ~KeepAliveDelegateTest() override {} 53 ~KeepAliveDelegateTest() override {}
55 54
56 protected: 55 protected:
57 void SetUp() override { 56 void SetUp() override {
58 inner_delegate_ = new MockCastTransportDelegate; 57 inner_delegate_ = new MockCastTransportDelegate;
59 logger_ = new Logger( 58 logger_ = new Logger();
60 std::unique_ptr<base::Clock>(new base::SimpleTestClock), base::Time());
61 keep_alive_.reset(new KeepAliveDelegate( 59 keep_alive_.reset(new KeepAliveDelegate(
62 &socket_, logger_, base::WrapUnique(inner_delegate_), 60 &socket_, logger_, base::WrapUnique(inner_delegate_),
63 base::TimeDelta::FromMilliseconds(kTestPingTimeoutMillis), 61 base::TimeDelta::FromMilliseconds(kTestPingTimeoutMillis),
64 base::TimeDelta::FromMilliseconds(kTestLivenessTimeoutMillis))); 62 base::TimeDelta::FromMilliseconds(kTestLivenessTimeoutMillis)));
65 liveness_timer_ = new MockTimerWithMonitoredReset(true, false); 63 liveness_timer_ = new MockTimerWithMonitoredReset(true, false);
66 ping_timer_ = new MockTimerWithMonitoredReset(true, false); 64 ping_timer_ = new MockTimerWithMonitoredReset(true, false);
67 EXPECT_CALL(*liveness_timer_, Stop()).Times(0); 65 EXPECT_CALL(*liveness_timer_, Stop()).Times(0);
68 EXPECT_CALL(*ping_timer_, Stop()).Times(0); 66 EXPECT_CALL(*ping_timer_, Stop()).Times(0);
69 keep_alive_->SetTimersForTest(base::WrapUnique(ping_timer_), 67 keep_alive_->SetTimersForTest(base::WrapUnique(ping_timer_),
70 base::WrapUnique(liveness_timer_)); 68 base::WrapUnique(liveness_timer_));
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 208
211 // Process a late-arriving PING/PONG message, which should have no effect. 209 // Process a late-arriving PING/PONG message, which should have no effect.
212 keep_alive_->OnMessage(late_ping_message); 210 keep_alive_->OnMessage(late_ping_message);
213 RunPendingTasks(); 211 RunPendingTasks();
214 } 212 }
215 213
216 } // namespace 214 } // namespace
217 } // namespace cast_channel 215 } // namespace cast_channel
218 } // namespace api 216 } // namespace api
219 } // namespace extensions 217 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698