summaryrefslogtreecommitdiffstats
path: root/components/mus/public/cpp/tests/test_window_tree.cc
blob: d1f7945eb182f94c5ed4fb6bda396f4314bed8bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// Copyright 2015 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.

#include "components/mus/public/cpp/tests/test_window_tree.h"

#include "testing/gtest/include/gtest/gtest.h"

namespace mus {

TestWindowTree::TestWindowTree() : got_change_(false), change_id_(0) {}

TestWindowTree::~TestWindowTree() {}

bool TestWindowTree::GetAndClearChangeId(uint32_t* change_id) {
  if (!got_change_)
    return false;

  if (change_id)
    *change_id = change_id_;
  got_change_ = false;
  return true;
}

bool TestWindowTree::WasEventAcked(uint32_t event_id) const {
  return acked_events_.count(event_id);
}

void TestWindowTree::NewWindow(
    uint32_t change_id,
    uint32_t window_id,
    mojo::Map<mojo::String, mojo::Array<uint8_t>> properties) {}

void TestWindowTree::DeleteWindow(uint32_t change_id, uint32_t window_id) {}

void TestWindowTree::SetWindowBounds(uint32_t change_id,
                                     uint32_t window_id,
                                     mojo::RectPtr bounds) {
  got_change_ = true;
  change_id_ = change_id;
}

void TestWindowTree::SetClientArea(
    uint32_t window_id,
    mojo::InsetsPtr insets,
    mojo::Array<mojo::RectPtr> additional_client_areas) {}

void TestWindowTree::SetWindowVisibility(uint32_t change_id,
                                         uint32_t window_id,
                                         bool visible) {
  got_change_ = true;
  change_id_ = change_id;
}

void TestWindowTree::SetWindowProperty(uint32_t change_id,
                                       uint32_t window_id,
                                       const mojo::String& name,
                                       mojo::Array<uint8_t> value) {
  got_change_ = true;
  change_id_ = change_id;
}

void TestWindowTree::AttachSurface(
    uint32_t window_id,
    mojom::SurfaceType type,
    mojo::InterfaceRequest<mojom::Surface> surface,
    mojom::SurfaceClientPtr client) {}

void TestWindowTree::AddWindow(uint32_t change_id,
                               uint32_t parent,
                               uint32_t child) {}

void TestWindowTree::RemoveWindowFromParent(uint32_t change_id,
                                            uint32_t window_id) {}

void TestWindowTree::AddTransientWindow(uint32_t change_id,
                                        uint32_t window_id,
                                        uint32_t transient_window_id) {}

void TestWindowTree::RemoveTransientWindowFromParent(
    uint32_t change_id,
    uint32_t transient_window_id) {}

void TestWindowTree::ReorderWindow(uint32_t change_id,
                                   uint32_t window_id,
                                   uint32_t relative_window_id,
                                   mojom::OrderDirection direction) {}

void TestWindowTree::GetWindowTree(uint32_t window_id,
                                   const GetWindowTreeCallback& callback) {}

void TestWindowTree::Embed(uint32_t window_id,
                           mojom::WindowTreeClientPtr client,
                           uint32_t policy_bitmask,
                           const EmbedCallback& callback) {}

void TestWindowTree::SetFocus(uint32_t change_id, uint32_t window_id) {
  got_change_ = true;
  change_id_ = change_id;
}

void TestWindowTree::SetCanFocus(uint32_t window_id, bool can_focus) {}

void TestWindowTree::SetPredefinedCursor(uint32_t change_id,
                                         uint32_t window_id,
                                         mus::mojom::Cursor cursor_id) {}

void TestWindowTree::SetWindowTextInputState(uint32_t window_id,
                                             mojo::TextInputStatePtr state) {}

void TestWindowTree::SetImeVisibility(uint32_t window_id,
                                      bool visible,
                                      mojo::TextInputStatePtr state) {}

void TestWindowTree::OnWindowInputEventAck(uint32_t event_id) {
  EXPECT_FALSE(acked_events_.count(event_id));
  acked_events_.insert(event_id);
}
void TestWindowTree::WmResponse(uint32_t change_id, bool response) {}

}  // namespace mus