OLD | NEW |
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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "third_party/skia/include/core/SkCanvas.h" | 10 #include "third_party/skia/include/core/SkCanvas.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 factory_.reset(new ui::DriSurfaceFactory(dri_.get(), screen_manager_.get())); | 73 factory_.reset(new ui::DriSurfaceFactory(dri_.get(), screen_manager_.get())); |
74 } | 74 } |
75 | 75 |
76 void DriSurfaceFactoryTest::TearDown() { | 76 void DriSurfaceFactoryTest::TearDown() { |
77 factory_.reset(); | 77 factory_.reset(); |
78 message_loop_.reset(); | 78 message_loop_.reset(); |
79 } | 79 } |
80 | 80 |
81 TEST_F(DriSurfaceFactoryTest, FailInitialization) { | 81 TEST_F(DriSurfaceFactoryTest, FailInitialization) { |
82 dri_->fail_init(); | 82 dri_->fail_init(); |
83 EXPECT_EQ(ui::SurfaceFactoryOzone::FAILED, factory_->InitializeHardware()); | 83 EXPECT_EQ(ui::DriSurfaceFactory::FAILED, factory_->InitializeHardware()); |
84 } | 84 } |
85 | 85 |
86 TEST_F(DriSurfaceFactoryTest, SuccessfulInitialization) { | 86 TEST_F(DriSurfaceFactoryTest, SuccessfulInitialization) { |
87 EXPECT_EQ(ui::SurfaceFactoryOzone::INITIALIZED, | 87 EXPECT_EQ(ui::DriSurfaceFactory::INITIALIZED, |
88 factory_->InitializeHardware()); | 88 factory_->InitializeHardware()); |
89 } | 89 } |
90 | 90 |
91 TEST_F(DriSurfaceFactoryTest, SuccessfulWidgetRealization) { | 91 TEST_F(DriSurfaceFactoryTest, SuccessfulWidgetRealization) { |
92 EXPECT_EQ(ui::SurfaceFactoryOzone::INITIALIZED, | 92 EXPECT_EQ(ui::DriSurfaceFactory::INITIALIZED, |
93 factory_->InitializeHardware()); | 93 factory_->InitializeHardware()); |
94 | 94 |
95 gfx::AcceleratedWidget w = factory_->GetAcceleratedWidget(); | 95 gfx::AcceleratedWidget w = factory_->GetAcceleratedWidget(); |
96 EXPECT_EQ(ui::DriSurfaceFactory::kDefaultWidgetHandle, w); | 96 EXPECT_EQ(ui::DriSurfaceFactory::kDefaultWidgetHandle, w); |
97 | 97 |
98 EXPECT_TRUE(factory_->CreateCanvasForWidget(w)); | 98 EXPECT_TRUE(factory_->CreateCanvasForWidget(w)); |
99 } | 99 } |
100 | 100 |
101 TEST_F(DriSurfaceFactoryTest, SetCursorImage) { | 101 TEST_F(DriSurfaceFactoryTest, SetCursorImage) { |
102 EXPECT_EQ(ui::SurfaceFactoryOzone::INITIALIZED, | 102 EXPECT_EQ(ui::DriSurfaceFactory::INITIALIZED, |
103 factory_->InitializeHardware()); | 103 factory_->InitializeHardware()); |
104 | 104 |
105 gfx::AcceleratedWidget w = factory_->GetAcceleratedWidget(); | 105 gfx::AcceleratedWidget w = factory_->GetAcceleratedWidget(); |
106 EXPECT_EQ(ui::DriSurfaceFactory::kDefaultWidgetHandle, w); | 106 EXPECT_EQ(ui::DriSurfaceFactory::kDefaultWidgetHandle, w); |
107 | 107 |
108 scoped_ptr<ui::SurfaceOzoneCanvas> surf = factory_->CreateCanvasForWidget(w); | 108 scoped_ptr<ui::SurfaceOzoneCanvas> surf = factory_->CreateCanvasForWidget(w); |
109 EXPECT_TRUE(surf); | 109 EXPECT_TRUE(surf); |
110 | 110 |
111 SkBitmap image; | 111 SkBitmap image; |
112 SkImageInfo info = SkImageInfo::Make( | 112 SkImageInfo info = SkImageInfo::Make( |
(...skipping 12 matching lines...) Expand all Loading... |
125 for (int i = 0; i < cursor.height(); ++i) { | 125 for (int i = 0; i < cursor.height(); ++i) { |
126 for (int j = 0; j < cursor.width(); ++j) { | 126 for (int j = 0; j < cursor.width(); ++j) { |
127 if (j < info.width() && i < info.height()) | 127 if (j < info.width() && i < info.height()) |
128 EXPECT_EQ(SK_ColorWHITE, cursor.getColor(j, i)); | 128 EXPECT_EQ(SK_ColorWHITE, cursor.getColor(j, i)); |
129 else | 129 else |
130 EXPECT_EQ(static_cast<SkColor>(SK_ColorTRANSPARENT), | 130 EXPECT_EQ(static_cast<SkColor>(SK_ColorTRANSPARENT), |
131 cursor.getColor(j, i)); | 131 cursor.getColor(j, i)); |
132 } | 132 } |
133 } | 133 } |
134 } | 134 } |
OLD | NEW |