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

Side by Side Diff: ui/display/manager/chromeos/touch_transform_controller_unittest.cc

Issue 2887413004: chromeos: moves setting of touch state to a separate class (Closed)
Patch Set: merge Created 3 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/display/manager/chromeos/touch_transform_controller.h" 5 #include "ui/display/manager/chromeos/touch_transform_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "ui/display/manager/chromeos/default_touch_transform_setter.h"
14 #include "ui/display/manager/display_manager.h" 15 #include "ui/display/manager/display_manager.h"
15 #include "ui/display/screen_base.h" 16 #include "ui/display/screen_base.h"
16 #include "ui/events/devices/device_data_manager.h" 17 #include "ui/events/devices/device_data_manager.h"
17 18
18 namespace display { 19 namespace display {
19 namespace test { 20 namespace test {
20 namespace { 21 namespace {
21 22
22 constexpr int kDisplayId1 = 1; 23 constexpr int kDisplayId1 = 1;
23 constexpr int kTouchId1 = 5; 24 constexpr int kTouchId1 = 5;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 touch_device); 116 touch_device);
116 } 117 }
117 118
118 // testing::Test: 119 // testing::Test:
119 void SetUp() override { 120 void SetUp() override {
120 ui::DeviceDataManager::CreateInstance(); 121 ui::DeviceDataManager::CreateInstance();
121 std::unique_ptr<ScreenBase> screen = base::MakeUnique<ScreenBase>(); 122 std::unique_ptr<ScreenBase> screen = base::MakeUnique<ScreenBase>();
122 Screen::SetScreenInstance(screen.get()); 123 Screen::SetScreenInstance(screen.get());
123 display_manager_ = base::MakeUnique<DisplayManager>(std::move(screen)); 124 display_manager_ = base::MakeUnique<DisplayManager>(std::move(screen));
124 touch_transform_controller_ = base::MakeUnique<TouchTransformController>( 125 touch_transform_controller_ = base::MakeUnique<TouchTransformController>(
125 nullptr, display_manager_.get()); 126 nullptr, display_manager_.get(),
127 base::MakeUnique<DefaultTouchTransformSetter>());
126 } 128 }
127 129
128 void TearDown() override { 130 void TearDown() override {
129 Screen::SetScreenInstance(nullptr); 131 Screen::SetScreenInstance(nullptr);
130 ui::DeviceDataManager::DeleteInstance(); 132 ui::DeviceDataManager::DeleteInstance();
131 } 133 }
132 134
133 private: 135 private:
134 std::unique_ptr<DisplayManager> display_manager_; 136 std::unique_ptr<DisplayManager> display_manager_;
135 std::unique_ptr<TouchTransformController> touch_transform_controller_; 137 std::unique_ptr<TouchTransformController> touch_transform_controller_;
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 840
839 x = 1782.0; 841 x = 1782.0;
840 y = 0.0; 842 y = 0.0;
841 device_manager->ApplyTouchTransformer(kTouchId1, &x, &y); 843 device_manager->ApplyTouchTransformer(kTouchId1, &x, &y);
842 EXPECT_NEAR(1920, x, 0.5); 844 EXPECT_NEAR(1920, x, 0.5);
843 EXPECT_NEAR(0, y, 0.5); 845 EXPECT_NEAR(0, y, 0.5);
844 } 846 }
845 847
846 } // namespace test 848 } // namespace test
847 } // namespace display 849 } // namespace display
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698