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

Side by Side Diff: ui/ozone/platform/dri/screen_manager_unittest.cc

Issue 393233005: [Ozone-DRI] Convert HardwareDisplayController to use scanout buffers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « ui/ozone/platform/dri/screen_manager.cc ('k') | ui/ozone/platform/dri/test/mock_dri_wrapper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "ui/ozone/platform/dri/dri_buffer.h"
6 #include "ui/ozone/platform/dri/hardware_display_controller.h" 7 #include "ui/ozone/platform/dri/hardware_display_controller.h"
7 #include "ui/ozone/platform/dri/screen_manager.h" 8 #include "ui/ozone/platform/dri/screen_manager.h"
8 #include "ui/ozone/platform/dri/test/mock_dri_wrapper.h" 9 #include "ui/ozone/platform/dri/test/mock_dri_wrapper.h"
9 #include "ui/ozone/platform/dri/test/mock_surface_generator.h"
10 10
11 namespace { 11 namespace {
12 12
13 // Create a basic mode for a 6x4 screen. 13 // Create a basic mode for a 6x4 screen.
14 const drmModeModeInfo kDefaultMode = 14 const drmModeModeInfo kDefaultMode =
15 {0, 6, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, {'\0'}}; 15 {0, 6, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, {'\0'}};
16 16
17 class MockScreenManager : public ui::ScreenManager { 17 class MockScreenManager : public ui::ScreenManager {
18 public: 18 public:
19 MockScreenManager(ui::DriWrapper* dri, 19 MockScreenManager(ui::DriWrapper* dri,
20 ui::ScanoutSurfaceGenerator* surface_generator) 20 ui::ScanoutBufferGenerator* buffer_generator)
21 : ScreenManager(dri, surface_generator), dri_(dri) {} 21 : ScreenManager(dri, buffer_generator), dri_(dri) {}
22 22
23 virtual void ForceInitializationOfPrimaryDisplay() OVERRIDE {} 23 virtual void ForceInitializationOfPrimaryDisplay() OVERRIDE {}
24 24
25 private: 25 private:
26 ui::DriWrapper* dri_; 26 ui::DriWrapper* dri_;
27 27
28 DISALLOW_COPY_AND_ASSIGN(MockScreenManager); 28 DISALLOW_COPY_AND_ASSIGN(MockScreenManager);
29 }; 29 };
30 30
31 } // namespace 31 } // namespace
32 32
33 class ScreenManagerTest : public testing::Test { 33 class ScreenManagerTest : public testing::Test {
34 public: 34 public:
35 ScreenManagerTest() {} 35 ScreenManagerTest() {}
36 virtual ~ScreenManagerTest() {} 36 virtual ~ScreenManagerTest() {}
37 37
38 virtual void SetUp() OVERRIDE { 38 virtual void SetUp() OVERRIDE {
39 dri_.reset(new ui::MockDriWrapper(3)); 39 dri_.reset(new ui::MockDriWrapper(3));
40 surface_generator_.reset(new ui::MockSurfaceGenerator(dri_.get())); 40 buffer_generator_.reset(new ui::DriBufferGenerator(dri_.get()));
41 screen_manager_.reset(new MockScreenManager( 41 screen_manager_.reset(new MockScreenManager(
42 dri_.get(), surface_generator_.get())); 42 dri_.get(), buffer_generator_.get()));
43 } 43 }
44 virtual void TearDown() OVERRIDE { 44 virtual void TearDown() OVERRIDE {
45 screen_manager_.reset(); 45 screen_manager_.reset();
46 dri_.reset(); 46 dri_.reset();
47 } 47 }
48 48
49 protected: 49 protected:
50 scoped_ptr<ui::MockDriWrapper> dri_; 50 scoped_ptr<ui::MockDriWrapper> dri_;
51 scoped_ptr<ui::MockSurfaceGenerator> surface_generator_; 51 scoped_ptr<ui::DriBufferGenerator> buffer_generator_;
52 scoped_ptr<MockScreenManager> screen_manager_; 52 scoped_ptr<MockScreenManager> screen_manager_;
53 53
54 private: 54 private:
55 DISALLOW_COPY_AND_ASSIGN(ScreenManagerTest); 55 DISALLOW_COPY_AND_ASSIGN(ScreenManagerTest);
56 }; 56 };
57 57
58 TEST_F(ScreenManagerTest, CheckWithNoControllers) { 58 TEST_F(ScreenManagerTest, CheckWithNoControllers) {
59 EXPECT_FALSE(screen_manager_->GetDisplayController(1)); 59 EXPECT_FALSE(screen_manager_->GetDisplayController(1));
60 } 60 }
61 61
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 drmModeModeInfo new_mode = kDefaultMode; 107 drmModeModeInfo new_mode = kDefaultMode;
108 new_mode.vdisplay = 10; 108 new_mode.vdisplay = 10;
109 screen_manager_->ConfigureDisplayController(1, 2, new_mode); 109 screen_manager_->ConfigureDisplayController(1, 2, new_mode);
110 110
111 EXPECT_TRUE(screen_manager_->GetDisplayController(1)); 111 EXPECT_TRUE(screen_manager_->GetDisplayController(1));
112 EXPECT_FALSE(screen_manager_->GetDisplayController(2)); 112 EXPECT_FALSE(screen_manager_->GetDisplayController(2));
113 drmModeModeInfo mode = screen_manager_->GetDisplayController(1)->get_mode(); 113 drmModeModeInfo mode = screen_manager_->GetDisplayController(1)->get_mode();
114 EXPECT_EQ(new_mode.vdisplay, mode.vdisplay); 114 EXPECT_EQ(new_mode.vdisplay, mode.vdisplay);
115 EXPECT_EQ(new_mode.hdisplay, mode.hdisplay); 115 EXPECT_EQ(new_mode.hdisplay, mode.hdisplay);
116 } 116 }
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/screen_manager.cc ('k') | ui/ozone/platform/dri/test/mock_dri_wrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698