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

Side by Side Diff: components/exo/display_unittest.cc

Issue 1412093006: components: Add Exosphere component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove some ifdefs Created 5 years, 1 month 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 | « components/exo/display.cc ('k') | components/exo/shared_memory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 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 "components/exo/buffer.h"
6 #include "components/exo/display.h"
7 #include "components/exo/shared_memory.h"
8 #include "components/exo/shell_surface.h"
9 #include "components/exo/surface.h"
10 #include "components/exo/test/exo_test_base.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12
13 namespace exo {
14 namespace {
15
16 using DisplayTest = test::ExoTestBase;
17
18 TEST_F(DisplayTest, CreateSurface) {
19 scoped_ptr<Display> display(new Display);
20
21 // Creating a surface should succeed.
22 scoped_ptr<Surface> surface = display->CreateSurface();
23 EXPECT_TRUE(surface);
24 }
25
26 TEST_F(DisplayTest, CreateSharedMemory) {
27 scoped_ptr<Display> display(new Display);
28
29 int shm_size = 8192;
30 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory);
31 bool rv = shared_memory->CreateAnonymous(shm_size);
32 ASSERT_TRUE(rv);
33
34 base::SharedMemoryHandle handle =
35 base::SharedMemory::DuplicateHandle(shared_memory->handle());
36 ASSERT_TRUE(base::SharedMemory::IsHandleValid(handle));
37
38 // Creating a shared memory instance from a valid handle should succeed.
39 scoped_ptr<SharedMemory> shm1 = display->CreateSharedMemory(handle, shm_size);
40 EXPECT_TRUE(shm1);
41
42 // Creating a shared memory instance from a invalid handle should fail.
43 scoped_ptr<SharedMemory> shm2 =
44 display->CreateSharedMemory(base::SharedMemoryHandle(), shm_size);
45 EXPECT_FALSE(shm2);
46 }
47
48 TEST_F(DisplayTest, CreateShellSurface) {
49 scoped_ptr<Display> display(new Display);
50
51 // Create two surfaces.
52 scoped_ptr<Surface> surface1 = display->CreateSurface();
53 EXPECT_TRUE(surface1);
54 scoped_ptr<Surface> surface2 = display->CreateSurface();
55 EXPECT_TRUE(surface2);
56
57 // Create a shell surface for surface1.
58 scoped_ptr<ShellSurface> shell_surface1 =
59 display->CreateShellSurface(surface1.get());
60
61 // Create a shell surface for surface2.
62 scoped_ptr<ShellSurface> shell_surface2 =
63 display->CreateShellSurface(surface2.get());
64 }
65
66 } // namespace
67 } // namespace exo
OLDNEW
« no previous file with comments | « components/exo/display.cc ('k') | components/exo/shared_memory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698