OLD | NEW |
---|---|
(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 "base/logging.h" | |
6 #include "base/message_loop/message_loop.h" | |
7 #include "mojo/public/cpp/bindings/binding.h" | |
8 #include "testing/gtest/include/gtest/gtest.h" | |
9 #include "ui/ozone/common/gpu/ozone_gpu_message_params.h" | |
10 #include "ui/ozone/common/mojo/ozone_gpu_message_params_test.mojom.h" | |
11 | |
12 namespace ui { | |
13 | |
14 class OzoneGpuMessageParamsTestImpl : public mojom::OzoneGpuMessageParamsTest { | |
kylechar
2017/01/17 21:39:46
You can put this class in an anonymous namespace.
thanhph1
2017/01/17 22:30:30
Done.
| |
15 public: | |
16 explicit OzoneGpuMessageParamsTestImpl( | |
17 mojo::InterfaceRequest<mojom::OzoneGpuMessageParamsTest> request) | |
18 : binding_(this, std::move(request)) {} | |
19 | |
20 // DisplayModeParamsTest: | |
21 void BounceDisplayModeParams( | |
22 const DisplayMode_Params& input, | |
23 const BounceDisplayModeParamsCallback& callback) override { | |
24 callback.Run(input); | |
25 } | |
26 | |
27 private: | |
28 mojo::Binding<OzoneGpuMessageParamsTest> binding_; | |
29 | |
30 DISALLOW_COPY_AND_ASSIGN(OzoneGpuMessageParamsTestImpl); | |
31 }; | |
32 | |
33 TEST(MojoDisplayModeStructTraitsTest, Basic) { | |
kylechar
2017/01/17 21:39:46
TEST(OzoneGpuStructTraitsTest, DisplayMode) {
thanhph1
2017/01/17 22:30:30
Done.
| |
34 // A MessageLoop is needed for Mojo IPC to work. | |
35 base::MessageLoop message_loop; | |
36 | |
37 mojom::OzoneGpuMessageParamsTestPtr proxy; | |
38 OzoneGpuMessageParamsTestImpl impl(MakeRequest(&proxy)); | |
39 | |
40 // prepare sample input with random values | |
41 DisplayMode_Params input; | |
42 input.size = gfx::Size(15, 29); | |
43 input.is_interlaced = true; | |
44 input.refresh_rate = 61; | |
45 | |
46 ui::DisplayMode_Params output; | |
47 | |
48 EXPECT_TRUE(proxy->BounceDisplayModeParams(input, &output)); | |
49 | |
50 // We want to test each component individually to make sure each data member | |
51 // was correctly serialized and deserialized. | |
52 EXPECT_EQ(input.size, output.size); | |
53 EXPECT_EQ(input.is_interlaced, output.is_interlaced); | |
54 EXPECT_EQ(input.refresh_rate, output.refresh_rate); | |
55 } | |
56 | |
57 } // namespace ui | |
OLD | NEW |