OLD | NEW |
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 "ui/events/platform/platform_event_source.h" | 5 #include "ui/events/platform/platform_event_source.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 // Provides mechanism for running tests from inside an active message-loop. | 495 // Provides mechanism for running tests from inside an active message-loop. |
496 class PlatformEventTestWithMessageLoop : public PlatformEventTest { | 496 class PlatformEventTestWithMessageLoop : public PlatformEventTest { |
497 public: | 497 public: |
498 PlatformEventTestWithMessageLoop() {} | 498 PlatformEventTestWithMessageLoop() {} |
499 ~PlatformEventTestWithMessageLoop() override {} | 499 ~PlatformEventTestWithMessageLoop() override {} |
500 | 500 |
501 void Run() { | 501 void Run() { |
502 message_loop_.task_runner()->PostTask( | 502 message_loop_.task_runner()->PostTask( |
503 FROM_HERE, base::Bind(&PlatformEventTestWithMessageLoop::RunTest, | 503 FROM_HERE, base::Bind(&PlatformEventTestWithMessageLoop::RunTest, |
504 base::Unretained(this))); | 504 base::Unretained(this))); |
505 message_loop_.Run(); | 505 base::RunLoop().Run(); |
506 } | 506 } |
507 | 507 |
508 protected: | 508 protected: |
509 void RunTest() { | 509 void RunTest() { |
510 RunTestImpl(); | 510 RunTestImpl(); |
511 message_loop_.QuitWhenIdle(); | 511 message_loop_.QuitWhenIdle(); |
512 } | 512 } |
513 | 513 |
514 virtual void RunTestImpl() = 0; | 514 virtual void RunTestImpl() = 0; |
515 | 515 |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 ASSERT_EQ(2u, list.size()); | 771 ASSERT_EQ(2u, list.size()); |
772 EXPECT_EQ(15, list[0]); | 772 EXPECT_EQ(15, list[0]); |
773 EXPECT_EQ(10, list[1]); | 773 EXPECT_EQ(10, list[1]); |
774 } | 774 } |
775 }; | 775 }; |
776 | 776 |
777 RUN_TEST_IN_MESSAGE_LOOP( | 777 RUN_TEST_IN_MESSAGE_LOOP( |
778 ConsecutiveOverriddenDispatcherInTheSameMessageLoopIteration) | 778 ConsecutiveOverriddenDispatcherInTheSameMessageLoopIteration) |
779 | 779 |
780 } // namespace ui | 780 } // namespace ui |
OLD | NEW |