| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "services/ui/ws/platform_display_default.h" | 5 #include "services/ui/ws/platform_display_default.h" |
| 6 | 6 |
| 7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "ui/base/cursor/image_cursors.h" | 9 #include "ui/base/cursor/image_cursors.h" |
| 10 #include "ui/display/types/native_display_delegate.h" | 10 #include "ui/display/types/native_display_delegate.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 override { | 92 override { |
| 93 return nullptr; | 93 return nullptr; |
| 94 } | 94 } |
| 95 void InitializeUI(const InitParams& params) override {} | 95 void InitializeUI(const InitParams& params) override {} |
| 96 void InitializeGPU(const InitParams& params) override {} | 96 void InitializeGPU(const InitParams& params) override {} |
| 97 | 97 |
| 98 private: | 98 private: |
| 99 DISALLOW_COPY_AND_ASSIGN(TestOzonePlatform); | 99 DISALLOW_COPY_AND_ASSIGN(TestOzonePlatform); |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 TEST(PlatformDisplayDefaultTest, EventDispatch) { | 102 // Test fails in part because services_unittests appears to have its own ozone |
| 103 // platform that it initializes. For some reason, this only started failing |
| 104 // locally and on the trybots on 06/13/2017, while passing when run on the CQ |
| 105 // and the builders. crbug.com/732987 |
| 106 TEST(PlatformDisplayDefaultTest, DISABLED_EventDispatch) { |
| 103 // Setup ozone so the display can be initialized. | 107 // Setup ozone so the display can be initialized. |
| 104 TestOzonePlatform platform; | 108 TestOzonePlatform platform; |
| 105 | 109 |
| 106 // Create the display. | 110 // Create the display. |
| 107 display::ViewportMetrics metrics; | 111 display::ViewportMetrics metrics; |
| 108 metrics.bounds_in_pixels = gfx::Rect(1024, 768); | 112 metrics.bounds_in_pixels = gfx::Rect(1024, 768); |
| 109 metrics.device_scale_factor = 1.f; | 113 metrics.device_scale_factor = 1.f; |
| 110 metrics.ui_scale_factor = 1.f; | 114 metrics.ui_scale_factor = 1.f; |
| 111 PlatformDisplayDefault display(nullptr, metrics, | 115 PlatformDisplayDefault display(nullptr, metrics, |
| 112 std::unique_ptr<ImageCursors>()); | 116 std::unique_ptr<ImageCursors>()); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // Releasing the key dispatches exactly one event. | 148 // Releasing the key dispatches exactly one event. |
| 145 KeyEvent key_released(ET_KEY_RELEASED, VKEY_A, EF_NONE); | 149 KeyEvent key_released(ET_KEY_RELEASED, VKEY_A, EF_NONE); |
| 146 display_for_dispatch->DispatchEvent(&key_released); | 150 display_for_dispatch->DispatchEvent(&key_released); |
| 147 EXPECT_EQ(1, event_sink.count_); | 151 EXPECT_EQ(1, event_sink.count_); |
| 148 EXPECT_EQ(ET_KEY_RELEASED, event_sink.last_event_type_); | 152 EXPECT_EQ(ET_KEY_RELEASED, event_sink.last_event_type_); |
| 149 } | 153 } |
| 150 | 154 |
| 151 } // namespace | 155 } // namespace |
| 152 } // namespace ws | 156 } // namespace ws |
| 153 } // namespace ui | 157 } // namespace ui |
| OLD | NEW |