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

Side by Side Diff: ui/gfx/mojo/struct_traits_unittest.cc

Issue 2683593006: Use OS_LINUX instead of USE_OZONE in ui/gfx/ when possible (Closed)
Patch Set: Rebase Created 3 years, 9 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
« no previous file with comments | « ui/gfx/mojo/buffer_types_struct_traits.cc ('k') | ui/gfx/native_pixmap_handle.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/message_loop/message_loop.h" 5 #include "base/message_loop/message_loop.h"
6 #include "mojo/public/cpp/bindings/binding_set.h" 6 #include "mojo/public/cpp/bindings/binding_set.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/gfx/mojo/traits_test_service.mojom.h" 8 #include "ui/gfx/mojo/traits_test_service.mojom.h"
9 #include "ui/gfx/native_widget_types.h" 9 #include "ui/gfx/native_widget_types.h"
10 #include "ui/gfx/selection_bound.h" 10 #include "ui/gfx/selection_bound.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 gfx::GpuMemoryBufferHandle output; 159 gfx::GpuMemoryBufferHandle output;
160 proxy->EchoGpuMemoryBufferHandle(handle, &output); 160 proxy->EchoGpuMemoryBufferHandle(handle, &output);
161 EXPECT_EQ(gfx::SHARED_MEMORY_BUFFER, output.type); 161 EXPECT_EQ(gfx::SHARED_MEMORY_BUFFER, output.type);
162 EXPECT_EQ(kId, output.id); 162 EXPECT_EQ(kId, output.id);
163 EXPECT_EQ(kOffset, output.offset); 163 EXPECT_EQ(kOffset, output.offset);
164 EXPECT_EQ(kStride, output.stride); 164 EXPECT_EQ(kStride, output.stride);
165 165
166 base::SharedMemory output_memory(output.handle, true); 166 base::SharedMemory output_memory(output.handle, true);
167 EXPECT_TRUE(output_memory.Map(1024)); 167 EXPECT_TRUE(output_memory.Map(1024));
168 168
169 #if defined(USE_OZONE) 169 #if defined(OS_LINUX)
170 const uint64_t kSize = kOffset + kStride; 170 const uint64_t kSize = kOffset + kStride;
171 const uint64_t kModifier = 2; 171 const uint64_t kModifier = 2;
172 handle.type = gfx::OZONE_NATIVE_PIXMAP; 172 handle.type = gfx::OZONE_NATIVE_PIXMAP;
173 handle.id = kId; 173 handle.id = kId;
174 handle.native_pixmap_handle.planes.emplace_back(kOffset, kStride, kSize, 174 handle.native_pixmap_handle.planes.emplace_back(kOffset, kStride, kSize,
175 kModifier); 175 kModifier);
176 proxy->EchoGpuMemoryBufferHandle(handle, &output); 176 proxy->EchoGpuMemoryBufferHandle(handle, &output);
177 EXPECT_EQ(gfx::OZONE_NATIVE_PIXMAP, output.type); 177 EXPECT_EQ(gfx::OZONE_NATIVE_PIXMAP, output.type);
178 EXPECT_EQ(kId, output.id); 178 EXPECT_EQ(kId, output.id);
179 ASSERT_EQ(1u, output.native_pixmap_handle.planes.size()); 179 ASSERT_EQ(1u, output.native_pixmap_handle.planes.size());
180 EXPECT_EQ(kSize, output.native_pixmap_handle.planes.back().size); 180 EXPECT_EQ(kSize, output.native_pixmap_handle.planes.back().size);
181 EXPECT_EQ(kModifier, output.native_pixmap_handle.planes.back().modifier); 181 EXPECT_EQ(kModifier, output.native_pixmap_handle.planes.back().modifier);
182 #endif 182 #endif
183 } 183 }
184 184
185 TEST_F(StructTraitsTest, NullGpuMemoryBufferHandle) { 185 TEST_F(StructTraitsTest, NullGpuMemoryBufferHandle) {
186 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); 186 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy();
187 GpuMemoryBufferHandle output; 187 GpuMemoryBufferHandle output;
188 proxy->EchoGpuMemoryBufferHandle(GpuMemoryBufferHandle(), &output); 188 proxy->EchoGpuMemoryBufferHandle(GpuMemoryBufferHandle(), &output);
189 EXPECT_TRUE(output.is_null()); 189 EXPECT_TRUE(output.is_null());
190 } 190 }
191 191
192 } // namespace gfx 192 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/mojo/buffer_types_struct_traits.cc ('k') | ui/gfx/native_pixmap_handle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698