diff options
author | sammc <sammc@chromium.org> | 2016-01-20 21:30:18 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-21 05:31:02 +0000 |
commit | 16fb38a8b87fe700645055e472d84de7aefe48a5 (patch) | |
tree | 02d83267f9a8a9f8e182c6a857347a7a683e81e6 /components/mus/ws/window_tree_unittest.cc | |
parent | c8a1187b4dfc11061d8ba792c73225196c56c6aa (diff) | |
download | chromium_src-16fb38a8b87fe700645055e472d84de7aefe48a5.zip chromium_src-16fb38a8b87fe700645055e472d84de7aefe48a5.tar.gz chromium_src-16fb38a8b87fe700645055e472d84de7aefe48a5.tar.bz2 |
Change mojo enums to be scoped enums in the generated C++ bindings.
Some mojo enums were previously not proper enums: they were constants
for bitfields. These have been replaced by const int32s in the mojoms:
- mus.mojom.EventFlags
- mus.mojom.MouseEventFlags
- mus.mojom.ResizeBehavior
- mus.mojom.WindowTree.AccessPolicy
Some mojo enum values now conflict with macros (mostly on Windows) and
needed to change:
- mus.mojom.Cursor.NULL became CURSOR_NULL (again)
- mus.mojom.KeyboardCode.DELETE became DELETE_KEY
- mus.mojom.WindowManagerErrorCode.ERROR_ACCESS_DENIED became
ACCESS_DENIED
- device.usb.TransferDirection.IN became INBOUND
- device.usb.TransferDirection.OUT became OUTBOUND
- device.usb.TransferStatus.ERROR became TRANSFER_ERROR
- device.NFCRecordType.OPAQUE became OPAQUE_RECORD
- media.interfaces.Decryptor.Status.ERROR became DECRYPTION_ERROR
- skia.AlphaType.OPAQUE became ALPHA_TYPE_OPAQUE
Review URL: https://codereview.chromium.org/1527183003
Cr-Commit-Position: refs/heads/master@{#370632}
Diffstat (limited to 'components/mus/ws/window_tree_unittest.cc')
-rw-r--r-- | components/mus/ws/window_tree_unittest.cc | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/components/mus/ws/window_tree_unittest.cc b/components/mus/ws/window_tree_unittest.cc index 6170173..1a8f84b 100644 --- a/components/mus/ws/window_tree_unittest.cc +++ b/components/mus/ws/window_tree_unittest.cc @@ -36,7 +36,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; @@ -284,7 +283,7 @@ class TestWindowTreeHostConnection : public WindowTreeHostConnection { connection_manager()->AddHost(this); set_window_tree(connection_manager()->EmbedAtWindow( window_tree_host()->root_window(), - mus::mojom::WindowTree::ACCESS_POLICY_EMBED_ROOT, + mus::mojom::WindowTree::kAccessPolicyEmbedRoot, mus::mojom::WindowTreeClientPtr())); } DISALLOW_COPY_AND_ASSIGN(TestWindowTreeHostConnection); @@ -411,7 +410,9 @@ class WindowTreeTest : public testing::Test { } 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_; } @@ -494,7 +495,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( GetWindowById(embed_window_id)); @@ -542,7 +543,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( GetWindowById(embed_window_id)); @@ -644,11 +645,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) { @@ -661,11 +662,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) { @@ -678,7 +679,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. @@ -696,20 +697,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. @@ -726,13 +727,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)); @@ -761,16 +762,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) { |