| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_AURA_TEST_MUS_CHANGE_COMPLETION_WAITER_H_ |
| 6 #define UI_AURA_TEST_MUS_CHANGE_COMPLETION_WAITER_H_ |
| 7 |
| 8 #include "base/callback_forward.h" |
| 9 #include "base/run_loop.h" |
| 10 #include "ui/aura/mus/window_tree_client_test_observer.h" |
| 11 |
| 12 namespace aura { |
| 13 class WindowTreeClient; |
| 14 enum class ChangeType; |
| 15 |
| 16 namespace test { |
| 17 |
| 18 // A class which will Wait for next change of |type| to complete. |
| 19 class ChangeCompletionWaiter : public WindowTreeClientTestObserver { |
| 20 public: |
| 21 ChangeCompletionWaiter(WindowTreeClient* client, |
| 22 ChangeType type, |
| 23 bool success); |
| 24 ~ChangeCompletionWaiter() override; |
| 25 |
| 26 // Wait for the first change that occurred after construction of this object |
| 27 // of |type| to complete. May return immediately if it's already done. |
| 28 void Wait(); |
| 29 |
| 30 private: |
| 31 // WindowTreeClientTestObserver: |
| 32 void OnChangeStarted(uint32_t change_id, |
| 33 aura::ChangeType type) override; |
| 34 void OnChangeCompleted(uint32_t change_id, |
| 35 aura::ChangeType type, |
| 36 bool success) override; |
| 37 |
| 38 base::RunLoop run_loop_; |
| 39 base::Closure quit_closure_; |
| 40 |
| 41 enum class WaitState { |
| 42 NOT_STARTED, |
| 43 WAITING, |
| 44 RECEIVED |
| 45 } state_; |
| 46 |
| 47 WindowTreeClient* client_; |
| 48 aura::ChangeType type_; |
| 49 uint32_t change_id_; |
| 50 bool success_; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(ChangeCompletionWaiter); |
| 53 }; |
| 54 |
| 55 } // namespace test |
| 56 } // namespace aura |
| 57 |
| 58 #endif // UI_AURA_TEST_MUS_CHANGE_COMPLETION_WAITER_H_ |
| OLD | NEW |