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

Side by Side Diff: gpu/vulkan/tests/vulkan_test.cc

Issue 1776453003: Added initial implementation of Vulkan Render Passes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn_vulkan
Patch Set: Fix SwapBuffers() present layout, test in unittests instead of injections Created 4 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "gpu/vulkan/tests/native_window.h"
6 #include "gpu/vulkan/vulkan_surface.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/gfx/geometry/rect.h"
9
10 // This file tests basic vulkan initialization steps.
11 namespace gpu {
12
13 class BasicVulkanTest : public testing::Test {
14 public:
15 void SetUp() override {
16 const gfx::Rect kDefaultBounds(10, 10, 100, 100);
17 window_ = CreateNativeWindow(kDefaultBounds);
18 }
19
20 void TearDown() override {
21 DestroyNativeWindow(window_);
22 window_ = gfx::kNullAcceleratedWidget;
23 }
24
25 gfx::AcceleratedWidget window() const { return window_; }
26
27 private:
28 gfx::AcceleratedWidget window_ = gfx::kNullAcceleratedWidget;
29 };
30
31 TEST_F(BasicVulkanTest, BasicVulkanSurface) {
32 scoped_ptr<VulkanSurface> surface =
33 VulkanSurface::CreateViewSurface(window());
34 EXPECT_TRUE(surface);
35 EXPECT_TRUE(surface->Initialize(VulkanSurface::SURFACE_GBRA8888));
36 surface->Destroy();
37 }
38
39 TEST_F(BasicVulkanTest, EmptyVulkanSwaps) {
40 scoped_ptr<VulkanSurface> surface =
41 VulkanSurface::CreateViewSurface(window());
42 EXPECT_TRUE(surface);
43 EXPECT_TRUE(surface->Initialize(VulkanSurface::SURFACE_GBRA8888));
44
45 // First swap is a special case, call it first to get better errors.
46 EXPECT_EQ(gfx::SwapResult::SWAP_ACK, surface->SwapBuffers());
47
48 // Also make sure we can swap multiple times.
49 for (int i = 0; i < 10; ++i) {
50 EXPECT_EQ(gfx::SwapResult::SWAP_ACK, surface->SwapBuffers());
51 }
52
53 surface->Destroy();
54 }
55
56 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698