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

Unified Diff: components/mus/ws/window_tree_unittest.cc

Issue 1527183003: Change mojo enums to be scoped enums in the generated C++ bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-binding-equals
Patch Set: Created 4 years, 12 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 side-by-side diff with in-line comments
Download patch
Index: components/mus/ws/window_tree_unittest.cc
diff --git a/components/mus/ws/window_tree_unittest.cc b/components/mus/ws/window_tree_unittest.cc
index 722f1974d449457a1cb03926af4b5ef404ec52f6..df8ae65a01f3fb292c4f462cd5d7daee0ae7a363 100644
--- a/components/mus/ws/window_tree_unittest.cc
+++ b/components/mus/ws/window_tree_unittest.cc
@@ -35,7 +35,6 @@
using mojo::Array;
using mojo::InterfaceRequest;
using mojo::String;
-using mus::mojom::ERROR_CODE_NONE;
using mus::mojom::Event;
using mus::mojom::EventPtr;
using mus::mojom::LocationData;
@@ -222,7 +221,7 @@ class TestWindowTreeHostConnection : public WindowTreeHostConnection {
connection_manager()->AddHost(this);
set_window_tree(connection_manager()->EmbedAtWindow(
window_tree_host()->root_window()->id(),
- mus::mojom::WindowTree::ACCESS_POLICY_EMBED_ROOT,
+ mus::mojom::WindowTree::kAccessPolicyEmbedRoot,
mus::mojom::WindowTreeClientPtr()));
}
DISALLOW_COPY_AND_ASSIGN(TestWindowTreeHostConnection);
@@ -340,7 +339,9 @@ class WindowTreeTest : public testing::Test {
ConnectionManager* connection_manager() { return connection_manager_.get(); }
TestWindowTreeClient* wm_client() { return wm_client_; }
- int32_t cursor_id() { return cursor_id_; }
+ mus::mojom::Cursor cursor_id() {
+ return static_cast<mus::mojom::Cursor>(cursor_id_);
+ }
TestWindowTreeHostConnection* host_connection() { return host_connection_; }
@@ -415,7 +416,7 @@ void WindowTreeTest::SetupEventTargeting(
wm_client()->Bind(std::move(client_request));
ConnectionSpecificId connection_id = 0;
wm_connection()->Embed(embed_window_id, std::move(client),
- mojom::WindowTree::ACCESS_POLICY_DEFAULT,
+ mojom::WindowTree::kAccessPolicyDefault,
&connection_id);
WindowTreeImpl* connection1 =
connection_manager()->GetConnectionWithRoot(embed_window_id);
@@ -462,7 +463,7 @@ TEST_F(WindowTreeTest, FocusOnPointer) {
wm_client()->Bind(std::move(client_request));
ConnectionSpecificId connection_id = 0;
wm_connection()->Embed(embed_window_id, std::move(client),
- mojom::WindowTree::ACCESS_POLICY_DEFAULT,
+ mojom::WindowTree::kAccessPolicyDefault,
&connection_id);
WindowTreeImpl* connection1 =
connection_manager()->GetConnectionWithRoot(embed_window_id);
@@ -563,11 +564,11 @@ TEST_F(WindowTreeTest, CursorChangesWhenMouseOverWindowAndWindowSetsCursor) {
// dispatched. This is only to place the mouse cursor over that window though.
DispatchEventAndAckImmediately(CreateMouseMoveEvent(21, 22));
- window->SetPredefinedCursor(mojom::Cursor::CURSOR_IBEAM);
+ window->SetPredefinedCursor(mojom::Cursor::IBEAM);
// Because the cursor is over the window when SetCursor was called, we should
// have immediately changed the cursor.
- EXPECT_EQ(mojom::Cursor::CURSOR_IBEAM, cursor_id());
+ EXPECT_EQ(mojom::Cursor::IBEAM, cursor_id());
}
TEST_F(WindowTreeTest, CursorChangesWhenEnteringWindowWithDifferentCursor) {
@@ -580,11 +581,11 @@ TEST_F(WindowTreeTest, CursorChangesWhenEnteringWindowWithDifferentCursor) {
// Let's create a pointer event outside the window and then move the pointer
// inside.
DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5));
- window->SetPredefinedCursor(mojom::Cursor::CURSOR_IBEAM);
+ window->SetPredefinedCursor(mojom::Cursor::IBEAM);
EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id());
DispatchEventAndAckImmediately(CreateMouseMoveEvent(21, 22));
- EXPECT_EQ(mojom::Cursor::CURSOR_IBEAM, cursor_id());
+ EXPECT_EQ(mojom::Cursor::IBEAM, cursor_id());
}
TEST_F(WindowTreeTest, TouchesDontChangeCursor) {
@@ -597,7 +598,7 @@ TEST_F(WindowTreeTest, TouchesDontChangeCursor) {
// Let's create a pointer event outside the window and then move the pointer
// inside.
DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5));
- window->SetPredefinedCursor(mojom::Cursor::CURSOR_IBEAM);
+ window->SetPredefinedCursor(mojom::Cursor::IBEAM);
EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id());
// With a touch event, we shouldn't update the cursor.
@@ -615,20 +616,20 @@ TEST_F(WindowTreeTest, DragOutsideWindow) {
// Start with the cursor outside the window. Setting the cursor shouldn't
// change the cursor.
DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5));
- window->SetPredefinedCursor(mojom::Cursor::CURSOR_IBEAM);
+ window->SetPredefinedCursor(mojom::Cursor::IBEAM);
EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id());
// Move the pointer to the inside of the window
DispatchEventAndAckImmediately(CreateMouseMoveEvent(21, 22));
- EXPECT_EQ(mojom::Cursor::CURSOR_IBEAM, cursor_id());
+ EXPECT_EQ(mojom::Cursor::IBEAM, cursor_id());
// Start the drag.
DispatchEventAndAckImmediately(CreateMouseDownEvent(21, 22));
- EXPECT_EQ(mojom::Cursor::CURSOR_IBEAM, cursor_id());
+ EXPECT_EQ(mojom::Cursor::IBEAM, cursor_id());
// Move the cursor (mouse is still down) outside the window.
DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5));
- EXPECT_EQ(mojom::Cursor::CURSOR_IBEAM, cursor_id());
+ EXPECT_EQ(mojom::Cursor::IBEAM, cursor_id());
// Release the cursor. We should now adapt the cursor of the window
// underneath the pointer.
@@ -645,13 +646,13 @@ TEST_F(WindowTreeTest, ChangingWindowBoundsChangesCursor) {
// Put the cursor just outside the bounds of the window.
DispatchEventAndAckImmediately(CreateMouseMoveEvent(41, 41));
- window->SetPredefinedCursor(mojom::Cursor::CURSOR_IBEAM);
+ window->SetPredefinedCursor(mojom::Cursor::IBEAM);
EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id());
// Expand the bounds of the window so they now include where the cursor now
// is.
window->SetBounds(gfx::Rect(20, 20, 25, 25));
- EXPECT_EQ(mojom::Cursor::CURSOR_IBEAM, cursor_id());
+ EXPECT_EQ(mojom::Cursor::IBEAM, cursor_id());
// Contract the bounds again.
window->SetBounds(gfx::Rect(20, 20, 20, 20));
@@ -679,16 +680,16 @@ TEST_F(WindowTreeTest, WindowReorderingChangesCursor) {
EnableHitTest(window2);
// Give each window a different cursor.
- window1->SetPredefinedCursor(mojom::Cursor::CURSOR_IBEAM);
- window2->SetPredefinedCursor(mojom::Cursor::CURSOR_HAND);
+ window1->SetPredefinedCursor(mojom::Cursor::IBEAM);
+ window2->SetPredefinedCursor(mojom::Cursor::HAND);
// We expect window2 to be over window1 now.
DispatchEventAndAckImmediately(CreateMouseMoveEvent(22, 22));
- EXPECT_EQ(mojom::Cursor::CURSOR_HAND, cursor_id());
+ EXPECT_EQ(mojom::Cursor::HAND, cursor_id());
// But when we put window2 at the bottom, we should adapt window1's cursor.
window2->parent()->StackChildAtBottom(window2);
- EXPECT_EQ(mojom::Cursor::CURSOR_IBEAM, cursor_id());
+ EXPECT_EQ(mojom::Cursor::IBEAM, cursor_id());
}
TEST_F(WindowTreeTest, EventAck) {

Powered by Google App Engine
This is Rietveld 408576698