| Index: ui/aura/test/mus/change_completion_waiter.h
|
| diff --git a/ui/aura/test/mus/change_completion_waiter.h b/ui/aura/test/mus/change_completion_waiter.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..bad862376e753fcefe699c2d14edb140749789fc
|
| --- /dev/null
|
| +++ b/ui/aura/test/mus/change_completion_waiter.h
|
| @@ -0,0 +1,58 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef UI_AURA_TEST_MUS_CHANGE_COMPLETION_WAITER_H_
|
| +#define UI_AURA_TEST_MUS_CHANGE_COMPLETION_WAITER_H_
|
| +
|
| +#include "base/callback_forward.h"
|
| +#include "base/run_loop.h"
|
| +#include "ui/aura/mus/window_tree_client_test_observer.h"
|
| +
|
| +namespace aura {
|
| +class WindowTreeClient;
|
| +enum class ChangeType;
|
| +
|
| +namespace test {
|
| +
|
| +// A class which will Wait for next change of |type| to complete.
|
| +class ChangeCompletionWaiter : public WindowTreeClientTestObserver {
|
| + public:
|
| + ChangeCompletionWaiter(WindowTreeClient* client,
|
| + ChangeType type,
|
| + bool success);
|
| + ~ChangeCompletionWaiter() override;
|
| +
|
| + // Wait for the first change that occurred after construction of this object
|
| + // of |type| to complete. May return immediately if it's already done.
|
| + void Wait();
|
| +
|
| + private:
|
| + // WindowTreeClientTestObserver:
|
| + void OnChangeStarted(uint32_t change_id,
|
| + aura::ChangeType type) override;
|
| + void OnChangeCompleted(uint32_t change_id,
|
| + aura::ChangeType type,
|
| + bool success) override;
|
| +
|
| + base::RunLoop run_loop_;
|
| + base::Closure quit_closure_;
|
| +
|
| + enum class WaitState {
|
| + NOT_STARTED,
|
| + WAITING,
|
| + RECEIVED
|
| + } state_;
|
| +
|
| + WindowTreeClient* client_;
|
| + aura::ChangeType type_;
|
| + uint32_t change_id_;
|
| + bool success_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ChangeCompletionWaiter);
|
| +};
|
| +
|
| +} // namespace test
|
| +} // namespace aura
|
| +
|
| +#endif // UI_AURA_TEST_MUS_CHANGE_COMPLETION_WAITER_H_
|
|
|