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

Side by Side Diff: ui/aura/test/mus/change_completion_waiter.cc

Issue 2633233003: aura-mus: Implement stacking in DesktopWindowTreeHostMus. (Closed)
Patch Set: Reword comment. Created 3 years, 11 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 | « ui/aura/test/mus/change_completion_waiter.h ('k') | ui/aura/test/mus/test_window_tree.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 #include "ui/aura/test/mus/change_completion_waiter.h"
6
7 #include "base/callback.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/aura/mus/in_flight_change.h"
10 #include "ui/aura/mus/window_tree_client.h"
11
12 namespace aura {
13 namespace test {
14
15 ChangeCompletionWaiter::ChangeCompletionWaiter(WindowTreeClient* client,
16 ChangeType type,
17 bool success)
18 : state_(WaitState::NOT_STARTED),
19 client_(client),
20 type_(type),
21 success_(success) {
22 client->AddTestObserver(this);
23 }
24
25 ChangeCompletionWaiter::~ChangeCompletionWaiter() {
26 client_->RemoveTestObserver(this);
27 }
28
29 void ChangeCompletionWaiter::Wait() {
30 if (state_ != WaitState::RECEIVED) {
31 quit_closure_ = run_loop_.QuitClosure();
32 run_loop_.Run();
33 }
34 }
35
36 void ChangeCompletionWaiter::OnChangeStarted(uint32_t change_id,
37 aura::ChangeType type) {
38 if (state_ == WaitState::NOT_STARTED && type == type_) {
39 state_ = WaitState::WAITING;
40 change_id_ = change_id;
41 }
42 }
43
44 void ChangeCompletionWaiter::OnChangeCompleted(uint32_t change_id,
45 aura::ChangeType type,
46 bool success) {
47 if (state_ == WaitState::WAITING && change_id_ == change_id) {
48 EXPECT_EQ(success_, success);
49 state_ = WaitState::RECEIVED;
50 if (quit_closure_)
51 quit_closure_.Run();
52 }
53 }
54
55 } // namespace test
56 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/test/mus/change_completion_waiter.h ('k') | ui/aura/test/mus/test_window_tree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698