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

Side by Side Diff: base/sync_socket_unittest.cc

Issue 614103004: replace 'virtual ... OVERRIDE' with '... override' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: process base/ Created 6 years, 2 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/sync_socket.h" 6 #include "base/sync_socket.h"
7 #include "base/threading/simple_thread.h" 7 #include "base/threading/simple_thread.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace { 11 namespace {
12 12
13 const int kReceiveTimeoutInMilliseconds = 750; 13 const int kReceiveTimeoutInMilliseconds = 750;
14 14
15 class HangingReceiveThread : public base::DelegateSimpleThread::Delegate { 15 class HangingReceiveThread : public base::DelegateSimpleThread::Delegate {
16 public: 16 public:
17 explicit HangingReceiveThread(base::SyncSocket* socket) 17 explicit HangingReceiveThread(base::SyncSocket* socket)
18 : socket_(socket), 18 : socket_(socket),
19 thread_(this, "HangingReceiveThread") { 19 thread_(this, "HangingReceiveThread") {
20 thread_.Start(); 20 thread_.Start();
21 } 21 }
22 22
23 virtual ~HangingReceiveThread() {} 23 virtual ~HangingReceiveThread() {}
24 24
25 virtual void Run() OVERRIDE { 25 void Run() override {
26 int data = 0; 26 int data = 0;
27 ASSERT_EQ(socket_->Peek(), 0u); 27 ASSERT_EQ(socket_->Peek(), 0u);
28 28
29 // Use receive with timeout so we don't hang the test harness indefinitely. 29 // Use receive with timeout so we don't hang the test harness indefinitely.
30 ASSERT_EQ(0u, socket_->ReceiveWithTimeout( 30 ASSERT_EQ(0u, socket_->ReceiveWithTimeout(
31 &data, sizeof(data), base::TimeDelta::FromMilliseconds( 31 &data, sizeof(data), base::TimeDelta::FromMilliseconds(
32 kReceiveTimeoutInMilliseconds))); 32 kReceiveTimeoutInMilliseconds)));
33 } 33 }
34 34
35 void Stop() { 35 void Stop() {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 ASSERT_TRUE(socket_b.Shutdown()); 122 ASSERT_TRUE(socket_b.Shutdown());
123 thread.Stop(); 123 thread.Stop();
124 124
125 // Ensure the receive didn't just timeout. 125 // Ensure the receive didn't just timeout.
126 ASSERT_LT((base::TimeTicks::Now() - start).InMilliseconds(), 126 ASSERT_LT((base::TimeTicks::Now() - start).InMilliseconds(),
127 kReceiveTimeoutInMilliseconds); 127 kReceiveTimeoutInMilliseconds);
128 128
129 ASSERT_TRUE(socket_a.Close()); 129 ASSERT_TRUE(socket_a.Close());
130 ASSERT_TRUE(socket_b.Close()); 130 ASSERT_TRUE(socket_b.Close());
131 } 131 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698