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

Side by Side Diff: ui/ozone/platform/dri/dri_surface_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
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 "third_party/skia/include/core/SkCanvas.h" 6 #include "third_party/skia/include/core/SkCanvas.h"
7 #include "third_party/skia/include/core/SkColor.h" 7 #include "third_party/skia/include/core/SkColor.h"
8 #include "third_party/skia/include/core/SkDevice.h" 8 #include "third_party/skia/include/core/SkDevice.h"
9 #include "ui/ozone/platform/dri/dri_buffer.h" 9 #include "ui/ozone/platform/dri/dri_buffer.h"
10 #include "ui/ozone/platform/dri/dri_surface.h" 10 #include "ui/ozone/platform/dri/dri_surface.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 drm_->set_create_dumb_buffer_expectation(false); 53 drm_->set_create_dumb_buffer_expectation(false);
54 EXPECT_FALSE(surface_->Initialize()); 54 EXPECT_FALSE(surface_->Initialize());
55 } 55 }
56 56
57 TEST_F(DriSurfaceTest, SuccessfulInitialization) { 57 TEST_F(DriSurfaceTest, SuccessfulInitialization) {
58 EXPECT_TRUE(surface_->Initialize()); 58 EXPECT_TRUE(surface_->Initialize());
59 } 59 }
60 60
61 TEST_F(DriSurfaceTest, CheckFBIDOnSwap) { 61 TEST_F(DriSurfaceTest, CheckFBIDOnSwap) {
62 EXPECT_TRUE(surface_->Initialize()); 62 EXPECT_TRUE(surface_->Initialize());
63 controller_->BindSurfaceToController(surface_.PassAs<ui::ScanoutSurface>(),
64 kDefaultMode);
65 63
66 // Check that the framebuffer ID is correct. 64 // Check that the framebuffer ID is correct.
67 EXPECT_EQ(2u, controller_->surface()->GetFramebufferId()); 65 EXPECT_EQ(2u, surface_->GetFramebufferId());
68 66
69 controller_->surface()->SwapBuffers(); 67 surface_->SwapBuffers();
70 68
71 EXPECT_EQ(1u, controller_->surface()->GetFramebufferId()); 69 EXPECT_EQ(1u, surface_->GetFramebufferId());
72 } 70 }
73 71
74 TEST_F(DriSurfaceTest, CheckPixelPointerOnSwap) { 72 TEST_F(DriSurfaceTest, CheckPixelPointerOnSwap) {
75 EXPECT_TRUE(surface_->Initialize()); 73 EXPECT_TRUE(surface_->Initialize());
76 74
77 void* bitmap_pixels1 = surface_->GetDrawableForWidget()->getDevice() 75 void* bitmap_pixels1 = surface_->GetDrawableForWidget()->getDevice()
78 ->accessBitmap(false).getPixels(); 76 ->accessBitmap(false).getPixels();
79 77
80 surface_->SwapBuffers(); 78 surface_->SwapBuffers();
81 79
82 void* bitmap_pixels2 = surface_->GetDrawableForWidget()->getDevice() 80 void* bitmap_pixels2 = surface_->GetDrawableForWidget()->getDevice()
83 ->accessBitmap(false).getPixels(); 81 ->accessBitmap(false).getPixels();
84 82
85 // Check that once the buffers have been swapped the drawable's underlying 83 // Check that once the buffers have been swapped the drawable's underlying
86 // pixels have been changed. 84 // pixels have been changed.
87 EXPECT_NE(bitmap_pixels1, bitmap_pixels2); 85 EXPECT_NE(bitmap_pixels1, bitmap_pixels2);
88 } 86 }
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/dri_surface_factory_unittest.cc ('k') | ui/ozone/platform/dri/gbm_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698