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

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

Issue 1819273002: exo: Improved implementation of child surfaces and popups. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix deps 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
« no previous file with comments | « components/exo/shell_surface.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "components/exo/buffer.h" 7 #include "components/exo/buffer.h"
8 #include "components/exo/shell_surface.h" 8 #include "components/exo/shell_surface.h"
9 #include "components/exo/surface.h" 9 #include "components/exo/surface.h"
10 #include "components/exo/test/exo_test_base.h" 10 #include "components/exo/test/exo_test_base.h"
11 #include "components/exo/test/exo_test_helper.h" 11 #include "components/exo/test/exo_test_helper.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 #include "ui/aura/window.h" 13 #include "ui/aura/window.h"
14 #include "ui/views/widget/widget.h" 14 #include "ui/views/widget/widget.h"
15 #include "ui/wm/core/window_util.h"
15 16
16 namespace exo { 17 namespace exo {
17 namespace { 18 namespace {
18 19
19 using ShellSurfaceTest = test::ExoTestBase; 20 using ShellSurfaceTest = test::ExoTestBase;
20 21
21 TEST_F(ShellSurfaceTest, SetParent) { 22 TEST_F(ShellSurfaceTest, SetParent) {
22 gfx::Size buffer_size(256, 256); 23 gfx::Size buffer_size(256, 256);
23 scoped_ptr<Buffer> parent_buffer( 24 scoped_ptr<Buffer> parent_buffer(
24 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 25 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
25 scoped_ptr<Surface> parent_surface(new Surface); 26 scoped_ptr<Surface> parent_surface(new Surface);
26 scoped_ptr<ShellSurface> parent_shell_surface( 27 scoped_ptr<ShellSurface> parent_shell_surface(
27 new ShellSurface(parent_surface.get())); 28 new ShellSurface(parent_surface.get()));
28 29
29 parent_surface->Attach(parent_buffer.get()); 30 parent_surface->Attach(parent_buffer.get());
30 parent_surface->Commit(); 31 parent_surface->Commit();
31 32
32 scoped_ptr<Buffer> buffer( 33 scoped_ptr<Buffer> buffer(
33 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 34 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
34 scoped_ptr<Surface> surface(new Surface); 35 scoped_ptr<Surface> surface(new Surface);
35 scoped_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 36 scoped_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
36 shell_surface->SetParent(parent_shell_surface.get()); 37 shell_surface->SetParent(parent_shell_surface.get());
37 38
38 surface->Attach(buffer.get()); 39 surface->Attach(buffer.get());
39 surface->Commit(); 40 surface->Commit();
40 EXPECT_EQ(shell_surface->GetWidget()->GetNativeWindow()->parent(), 41 EXPECT_EQ(
41 parent_shell_surface->GetWidget()->GetNativeWindow()); 42 parent_shell_surface->GetWidget()->GetNativeWindow(),
43 wm::GetTransientParent(shell_surface->GetWidget()->GetNativeWindow()));
42 } 44 }
43 45
44 TEST_F(ShellSurfaceTest, Maximize) { 46 TEST_F(ShellSurfaceTest, Maximize) {
45 gfx::Size buffer_size(256, 256); 47 gfx::Size buffer_size(256, 256);
46 scoped_ptr<Buffer> buffer( 48 scoped_ptr<Buffer> buffer(
47 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 49 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
48 scoped_ptr<Surface> surface(new Surface); 50 scoped_ptr<Surface> surface(new Surface);
49 scoped_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 51 scoped_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
50 52
51 surface->Attach(buffer.get()); 53 surface->Attach(buffer.get());
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 surface->Attach(buffer.get()); 218 surface->Attach(buffer.get());
217 surface->Commit(); 219 surface->Commit();
218 shell_surface->GetWidget()->Activate(); 220 shell_surface->GetWidget()->Activate();
219 EXPECT_TRUE(is_active); 221 EXPECT_TRUE(is_active);
220 shell_surface->GetWidget()->Deactivate(); 222 shell_surface->GetWidget()->Deactivate();
221 EXPECT_FALSE(is_active); 223 EXPECT_FALSE(is_active);
222 } 224 }
223 225
224 } // namespace 226 } // namespace
225 } // namespace exo 227 } // namespace exo
OLDNEW
« no previous file with comments | « components/exo/shell_surface.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698