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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/exo/display.cc ('k') | components/exo/shared_memory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/display_unittest.cc
diff --git a/components/exo/display_unittest.cc b/components/exo/display_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..827452942f8920f2de70dfc9e648fc008dadb129
--- /dev/null
+++ b/components/exo/display_unittest.cc
@@ -0,0 +1,67 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/exo/buffer.h"
+#include "components/exo/display.h"
+#include "components/exo/shared_memory.h"
+#include "components/exo/shell_surface.h"
+#include "components/exo/surface.h"
+#include "components/exo/test/exo_test_base.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace exo {
+namespace {
+
+using DisplayTest = test::ExoTestBase;
+
+TEST_F(DisplayTest, CreateSurface) {
+ scoped_ptr<Display> display(new Display);
+
+ // Creating a surface should succeed.
+ scoped_ptr<Surface> surface = display->CreateSurface();
+ EXPECT_TRUE(surface);
+}
+
+TEST_F(DisplayTest, CreateSharedMemory) {
+ scoped_ptr<Display> display(new Display);
+
+ int shm_size = 8192;
+ scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory);
+ bool rv = shared_memory->CreateAnonymous(shm_size);
+ ASSERT_TRUE(rv);
+
+ base::SharedMemoryHandle handle =
+ base::SharedMemory::DuplicateHandle(shared_memory->handle());
+ ASSERT_TRUE(base::SharedMemory::IsHandleValid(handle));
+
+ // Creating a shared memory instance from a valid handle should succeed.
+ scoped_ptr<SharedMemory> shm1 = display->CreateSharedMemory(handle, shm_size);
+ EXPECT_TRUE(shm1);
+
+ // Creating a shared memory instance from a invalid handle should fail.
+ scoped_ptr<SharedMemory> shm2 =
+ display->CreateSharedMemory(base::SharedMemoryHandle(), shm_size);
+ EXPECT_FALSE(shm2);
+}
+
+TEST_F(DisplayTest, CreateShellSurface) {
+ scoped_ptr<Display> display(new Display);
+
+ // Create two surfaces.
+ scoped_ptr<Surface> surface1 = display->CreateSurface();
+ EXPECT_TRUE(surface1);
+ scoped_ptr<Surface> surface2 = display->CreateSurface();
+ EXPECT_TRUE(surface2);
+
+ // Create a shell surface for surface1.
+ scoped_ptr<ShellSurface> shell_surface1 =
+ display->CreateShellSurface(surface1.get());
+
+ // Create a shell surface for surface2.
+ scoped_ptr<ShellSurface> shell_surface2 =
+ display->CreateShellSurface(surface2.get());
+}
+
+} // namespace
+} // namespace exo
« 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