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

Side by Side Diff: base/posix/file_descriptor_shuffle_unittest.cc

Issue 611153004: replace OVERRIDE and FINAL with override and final in base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CC_ -> 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
« no previous file with comments | « base/posix/file_descriptor_shuffle.h ('k') | base/power_monitor/power_monitor_device_source.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 // 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/posix/file_descriptor_shuffle.h" 5 #include "base/posix/file_descriptor_shuffle.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 namespace { 8 namespace {
9 9
10 // 'Duplicated' file descriptors start at this number 10 // 'Duplicated' file descriptors start at this number
(...skipping 26 matching lines...) Expand all
37 int fd1; 37 int fd1;
38 int fd2; 38 int fd2;
39 }; 39 };
40 40
41 class InjectionTracer : public InjectionDelegate { 41 class InjectionTracer : public InjectionDelegate {
42 public: 42 public:
43 InjectionTracer() 43 InjectionTracer()
44 : next_duplicate_(kDuplicateBase) { 44 : next_duplicate_(kDuplicateBase) {
45 } 45 }
46 46
47 virtual bool Duplicate(int* result, int fd) OVERRIDE { 47 virtual bool Duplicate(int* result, int fd) override {
48 *result = next_duplicate_++; 48 *result = next_duplicate_++;
49 actions_.push_back(Action(Action::DUPLICATE, *result, fd)); 49 actions_.push_back(Action(Action::DUPLICATE, *result, fd));
50 return true; 50 return true;
51 } 51 }
52 52
53 virtual bool Move(int src, int dest) OVERRIDE { 53 virtual bool Move(int src, int dest) override {
54 actions_.push_back(Action(Action::MOVE, src, dest)); 54 actions_.push_back(Action(Action::MOVE, src, dest));
55 return true; 55 return true;
56 } 56 }
57 57
58 virtual void Close(int fd) OVERRIDE { 58 virtual void Close(int fd) override {
59 actions_.push_back(Action(Action::CLOSE, fd)); 59 actions_.push_back(Action(Action::CLOSE, fd));
60 } 60 }
61 61
62 const std::vector<Action>& actions() const { return actions_; } 62 const std::vector<Action>& actions() const { return actions_; }
63 63
64 private: 64 private:
65 int next_duplicate_; 65 int next_duplicate_;
66 std::vector<Action> actions_; 66 std::vector<Action> actions_;
67 }; 67 };
68 68
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 243
244 EXPECT_TRUE(PerformInjectiveMultimap(map, &tracer)); 244 EXPECT_TRUE(PerformInjectiveMultimap(map, &tracer));
245 ASSERT_EQ(3u, tracer.actions().size()); 245 ASSERT_EQ(3u, tracer.actions().size());
246 EXPECT_TRUE(tracer.actions()[0] == Action(Action::MOVE, 0, 1)); 246 EXPECT_TRUE(tracer.actions()[0] == Action(Action::MOVE, 0, 1));
247 EXPECT_TRUE(tracer.actions()[1] == Action(Action::MOVE, 0, 2)); 247 EXPECT_TRUE(tracer.actions()[1] == Action(Action::MOVE, 0, 2));
248 EXPECT_TRUE(tracer.actions()[2] == Action(Action::CLOSE, 0)); 248 EXPECT_TRUE(tracer.actions()[2] == Action(Action::CLOSE, 0));
249 } 249 }
250 250
251 class FailingDelegate : public InjectionDelegate { 251 class FailingDelegate : public InjectionDelegate {
252 public: 252 public:
253 virtual bool Duplicate(int* result, int fd) OVERRIDE { 253 virtual bool Duplicate(int* result, int fd) override {
254 return false; 254 return false;
255 } 255 }
256 256
257 virtual bool Move(int src, int dest) OVERRIDE { 257 virtual bool Move(int src, int dest) override {
258 return false; 258 return false;
259 } 259 }
260 260
261 virtual void Close(int fd) OVERRIDE {} 261 virtual void Close(int fd) override {}
262 }; 262 };
263 263
264 TEST(FileDescriptorShuffleTest, EmptyWithFailure) { 264 TEST(FileDescriptorShuffleTest, EmptyWithFailure) {
265 InjectiveMultimap map; 265 InjectiveMultimap map;
266 FailingDelegate failing; 266 FailingDelegate failing;
267 267
268 EXPECT_TRUE(PerformInjectiveMultimap(map, &failing)); 268 EXPECT_TRUE(PerformInjectiveMultimap(map, &failing));
269 } 269 }
270 270
271 TEST(FileDescriptorShuffleTest, NoopWithFailure) { 271 TEST(FileDescriptorShuffleTest, NoopWithFailure) {
272 InjectiveMultimap map; 272 InjectiveMultimap map;
273 FailingDelegate failing; 273 FailingDelegate failing;
274 map.push_back(InjectionArc(0, 0, false)); 274 map.push_back(InjectionArc(0, 0, false));
275 275
276 EXPECT_TRUE(PerformInjectiveMultimap(map, &failing)); 276 EXPECT_TRUE(PerformInjectiveMultimap(map, &failing));
277 } 277 }
278 278
279 TEST(FileDescriptorShuffleTest, Simple1WithFailure) { 279 TEST(FileDescriptorShuffleTest, Simple1WithFailure) {
280 InjectiveMultimap map; 280 InjectiveMultimap map;
281 FailingDelegate failing; 281 FailingDelegate failing;
282 map.push_back(InjectionArc(0, 1, false)); 282 map.push_back(InjectionArc(0, 1, false));
283 283
284 EXPECT_FALSE(PerformInjectiveMultimap(map, &failing)); 284 EXPECT_FALSE(PerformInjectiveMultimap(map, &failing));
285 } 285 }
286 286
287 } // namespace base 287 } // namespace base
OLDNEW
« no previous file with comments | « base/posix/file_descriptor_shuffle.h ('k') | base/power_monitor/power_monitor_device_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698