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

Side by Side Diff: extensions/browser/api/cast_channel/cast_socket_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 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 "extensions/browser/api/cast_channel/cast_socket.h" 5 #include "extensions/browser/api/cast_channel/cast_socket.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
17 #include "base/run_loop.h" 17 #include "base/run_loop.h"
18 #include "base/single_thread_task_runner.h" 18 #include "base/single_thread_task_runner.h"
19 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
20 #include "base/sys_byteorder.h" 20 #include "base/sys_byteorder.h"
21 #include "base/test/simple_test_clock.h"
22 #include "base/threading/thread_task_runner_handle.h" 21 #include "base/threading/thread_task_runner_handle.h"
23 #include "base/timer/mock_timer.h" 22 #include "base/timer/mock_timer.h"
24 #include "extensions/browser/api/cast_channel/cast_auth_util.h" 23 #include "extensions/browser/api/cast_channel/cast_auth_util.h"
25 #include "extensions/browser/api/cast_channel/cast_framer.h" 24 #include "extensions/browser/api/cast_channel/cast_framer.h"
26 #include "extensions/browser/api/cast_channel/cast_message_util.h" 25 #include "extensions/browser/api/cast_channel/cast_message_util.h"
27 #include "extensions/browser/api/cast_channel/cast_test_util.h" 26 #include "extensions/browser/api/cast_channel/cast_test_util.h"
28 #include "extensions/browser/api/cast_channel/cast_transport.h" 27 #include "extensions/browser/api/cast_channel/cast_transport.h"
29 #include "extensions/browser/api/cast_channel/logger.h" 28 #include "extensions/browser/api/cast_channel/logger.h"
30 #include "extensions/common/api/cast_channel/cast_channel.pb.h" 29 #include "extensions/common/api/cast_channel/cast_channel.pb.h"
31 #include "extensions/common/api/cast_channel/logging.pb.h" 30 #include "extensions/common/api/cast_channel/logging.pb.h"
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 // If true, makes TCP connection process stall. For timeout testing. 340 // If true, makes TCP connection process stall. For timeout testing.
342 bool tcp_unresponsive_; 341 bool tcp_unresponsive_;
343 std::unique_ptr<base::MockTimer> mock_timer_; 342 std::unique_ptr<base::MockTimer> mock_timer_;
344 MockCastTransport* mock_transport_; 343 MockCastTransport* mock_transport_;
345 344
346 DISALLOW_COPY_AND_ASSIGN(TestCastSocket); 345 DISALLOW_COPY_AND_ASSIGN(TestCastSocket);
347 }; 346 };
348 347
349 class CastSocketTest : public testing::Test { 348 class CastSocketTest : public testing::Test {
350 public: 349 public:
351 CastSocketTest() 350 CastSocketTest() : logger_(new Logger()), delegate_(new MockDelegate) {}
352 : logger_(
353 new Logger(base::WrapUnique<base::Clock>(new base::SimpleTestClock),
354 base::Time())),
355 delegate_(new MockDelegate) {}
356 ~CastSocketTest() override {} 351 ~CastSocketTest() override {}
357 352
358 void SetUp() override { EXPECT_CALL(*delegate_, OnMessage(_)).Times(0); } 353 void SetUp() override { EXPECT_CALL(*delegate_, OnMessage(_)).Times(0); }
359 354
360 void TearDown() override { 355 void TearDown() override {
361 if (socket_.get()) { 356 if (socket_.get()) {
362 EXPECT_CALL(handler_, OnCloseComplete(net::OK)); 357 EXPECT_CALL(handler_, OnCloseComplete(net::OK));
363 socket_->Close(base::Bind(&CompleteHandler::OnCloseComplete, 358 socket_->Close(base::Bind(&CompleteHandler::OnCloseComplete,
364 base::Unretained(&handler_))); 359 base::Unretained(&handler_)));
365 } 360 }
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 base::Unretained(&handler_))); 772 base::Unretained(&handler_)));
778 RunPendingTasks(); 773 RunPendingTasks();
779 774
780 EXPECT_EQ(cast_channel::READY_STATE_OPEN, socket_->ready_state()); 775 EXPECT_EQ(cast_channel::READY_STATE_OPEN, socket_->ready_state());
781 EXPECT_EQ(cast_channel::CHANNEL_ERROR_NONE, socket_->error_state()); 776 EXPECT_EQ(cast_channel::CHANNEL_ERROR_NONE, socket_->error_state());
782 } 777 }
783 778
784 } // namespace cast_channel 779 } // namespace cast_channel
785 } // namespace api 780 } // namespace api
786 } // namespace extensions 781 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698