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

Side by Side Diff: base/threading/platform_thread_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/compiler_specific.h" 5 #include "base/compiler_specific.h"
6 #include "base/threading/platform_thread.h" 6 #include "base/threading/platform_thread.h"
7 7
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace base { 10 namespace base {
11 11
12 // Trivial tests that thread runs and doesn't crash on create and join --------- 12 // Trivial tests that thread runs and doesn't crash on create and join ---------
13 13
14 class TrivialThread : public PlatformThread::Delegate { 14 class TrivialThread : public PlatformThread::Delegate {
15 public: 15 public:
16 TrivialThread() : did_run_(false) {} 16 TrivialThread() : did_run_(false) {}
17 17
18 virtual void ThreadMain() OVERRIDE { 18 void ThreadMain() override { did_run_ = true; }
19 did_run_ = true;
20 }
21 19
22 bool did_run() const { return did_run_; } 20 bool did_run() const { return did_run_; }
23 21
24 private: 22 private:
25 bool did_run_; 23 bool did_run_;
26 24
27 DISALLOW_COPY_AND_ASSIGN(TrivialThread); 25 DISALLOW_COPY_AND_ASSIGN(TrivialThread);
28 }; 26 };
29 27
30 TEST(PlatformThreadTest, Trivial) { 28 TEST(PlatformThreadTest, Trivial) {
(...skipping 19 matching lines...) Expand all
50 for (size_t n = 0; n < arraysize(thread); n++) 48 for (size_t n = 0; n < arraysize(thread); n++)
51 ASSERT_TRUE(thread[n].did_run()); 49 ASSERT_TRUE(thread[n].did_run());
52 } 50 }
53 51
54 // Tests of basic thread functions --------------------------------------------- 52 // Tests of basic thread functions ---------------------------------------------
55 53
56 class FunctionTestThread : public TrivialThread { 54 class FunctionTestThread : public TrivialThread {
57 public: 55 public:
58 FunctionTestThread() : thread_id_(0) {} 56 FunctionTestThread() : thread_id_(0) {}
59 57
60 virtual void ThreadMain() OVERRIDE { 58 void ThreadMain() override {
61 thread_id_ = PlatformThread::CurrentId(); 59 thread_id_ = PlatformThread::CurrentId();
62 PlatformThread::YieldCurrentThread(); 60 PlatformThread::YieldCurrentThread();
63 PlatformThread::Sleep(TimeDelta::FromMilliseconds(50)); 61 PlatformThread::Sleep(TimeDelta::FromMilliseconds(50));
64 62
65 // Make sure that the thread ID is the same across calls. 63 // Make sure that the thread ID is the same across calls.
66 EXPECT_EQ(thread_id_, PlatformThread::CurrentId()); 64 EXPECT_EQ(thread_id_, PlatformThread::CurrentId());
67 65
68 TrivialThread::ThreadMain(); 66 TrivialThread::ThreadMain();
69 } 67 }
70 68
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 for (size_t i = 0; i < n; ++i) { 110 for (size_t i = 0; i < n; ++i) {
113 EXPECT_NE(thread[i].thread_id(), thread[n].thread_id()); 111 EXPECT_NE(thread[i].thread_id(), thread[n].thread_id());
114 } 112 }
115 } 113 }
116 114
117 // Make sure that the thread ID is the same across calls. 115 // Make sure that the thread ID is the same across calls.
118 EXPECT_EQ(main_thread_id, PlatformThread::CurrentId()); 116 EXPECT_EQ(main_thread_id, PlatformThread::CurrentId());
119 } 117 }
120 118
121 } // namespace base 119 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698