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

Side by Side Diff: mojo/edk/system/awakable_list_unittest.cc

Issue 2076263003: Plumb the handle signals state to Awakable::Awake(). (Closed) Base URL: https://github.com/domokit/mojo.git@work794_wait_set_4.2
Patch Set: Created 4 years, 6 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 | « mojo/edk/system/awakable_list.cc ('k') | mojo/edk/system/core_unittest.cc » ('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 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 // NOTE(vtl): Some of these tests are inherently flaky (e.g., if run on a 5 // NOTE(vtl): Some of these tests are inherently flaky (e.g., if run on a
6 // heavily-loaded system). Sorry. |test::EpsilonTimeout()| may be increased to 6 // heavily-loaded system). Sorry. |test::EpsilonTimeout()| may be increased to
7 // increase tolerance and reduce observed flakiness (though doing so reduces the 7 // increase tolerance and reduce observed flakiness (though doing so reduces the
8 // meaningfulness of the test). 8 // meaningfulness of the test).
9 9
10 #include "mojo/edk/system/awakable_list.h" 10 #include "mojo/edk/system/awakable_list.h"
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 awakable_list.RemoveWithContext(thread.waiter(), 2); 372 awakable_list.RemoveWithContext(thread.waiter(), 2);
373 } // Join |thread|. 373 } // Join |thread|.
374 EXPECT_EQ(MOJO_RESULT_OK, result); 374 EXPECT_EQ(MOJO_RESULT_OK, result);
375 EXPECT_EQ(2u, context); 375 EXPECT_EQ(2u, context);
376 } 376 }
377 377
378 class KeepAwakable : public Awakable { 378 class KeepAwakable : public Awakable {
379 public: 379 public:
380 KeepAwakable() : awake_count(0) {} 380 KeepAwakable() : awake_count(0) {}
381 381
382 bool Awake(MojoResult result, uint64_t context) override { 382 bool Awake(uint64_t context,
383 AwakeReason reason,
384 const HandleSignalsState& signals_state) override {
383 awake_count++; 385 awake_count++;
384 return true; 386 return true;
385 } 387 }
386 388
387 int awake_count; 389 int awake_count;
388 390
389 MOJO_DISALLOW_COPY_AND_ASSIGN(KeepAwakable); 391 MOJO_DISALLOW_COPY_AND_ASSIGN(KeepAwakable);
390 }; 392 };
391 393
392 class RemoveAwakable : public Awakable { 394 class RemoveAwakable : public Awakable {
393 public: 395 public:
394 RemoveAwakable() : awake_count(0) {} 396 RemoveAwakable() : awake_count(0) {}
395 397
396 bool Awake(MojoResult result, uint64_t context) override { 398 bool Awake(uint64_t /*context*/,
399 AwakeReason /*reason*/,
400 const HandleSignalsState& /*signals_state*/) override {
397 awake_count++; 401 awake_count++;
398 return false; 402 return false;
399 } 403 }
400 404
401 int awake_count; 405 int awake_count;
402 406
403 MOJO_DISALLOW_COPY_AND_ASSIGN(RemoveAwakable); 407 MOJO_DISALLOW_COPY_AND_ASSIGN(RemoveAwakable);
404 }; 408 };
405 409
406 TEST(AwakableListTest, KeepAwakablesReturningTrue) { 410 TEST(AwakableListTest, KeepAwakablesReturningTrue) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 EXPECT_EQ(keep1.awake_count, 2); 453 EXPECT_EQ(keep1.awake_count, 2);
450 EXPECT_EQ(remove2.awake_count, 1); 454 EXPECT_EQ(remove2.awake_count, 1);
451 455
452 remove_first.Remove(&keep0); 456 remove_first.Remove(&keep0);
453 remove_first.Remove(&keep1); 457 remove_first.Remove(&keep1);
454 } 458 }
455 459
456 } // namespace 460 } // namespace
457 } // namespace system 461 } // namespace system
458 } // namespace mojo 462 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/awakable_list.cc ('k') | mojo/edk/system/core_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698