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

Side by Side Diff: ui/base/accelerators/mojo/accelerator_struct_traits_unittest.cc

Issue 2749183005: Adds mojom structure for ui::Accelerator and struct traits (Closed)
Patch Set: feedback Created 3 years, 9 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/base/accelerators/mojo/accelerator_struct_traits.h ('k') | no next file » | 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/base/accelerators/mojo/accelerator_struct_traits.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/base/accelerators/accelerator.h"
9 #include "ui/base/accelerators/mojo/accelerator.mojom.h"
10 #include "ui/events/event_constants.h"
11
12 namespace ui {
13
14 TEST(AcceleratorStructTraitsTest, SerializeAndDeserialize1) {
15 Accelerator accelerator(KeyboardCode::VKEY_TAB, EF_NUM_LOCK_ON);
16 accelerator.set_key_state(ui::Accelerator::KeyState::RELEASED);
17 Accelerator deserialized;
18 ASSERT_TRUE(mojom::Accelerator::Deserialize(
19 mojom::Accelerator::Serialize(&accelerator), &deserialized));
20 EXPECT_EQ(accelerator, deserialized);
21 }
22
23 TEST(AcceleratorStructTraitsTest, SerializeAndDeserialize2) {
24 const Accelerator accelerator(KeyboardCode::VKEY_SPACE, EF_SHIFT_DOWN);
25 Accelerator deserialized;
26 ASSERT_TRUE(mojom::Accelerator::Deserialize(
27 mojom::Accelerator::Serialize(&accelerator), &deserialized));
28 EXPECT_EQ(accelerator, deserialized);
29 }
30
31 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/accelerators/mojo/accelerator_struct_traits.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698