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

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

Issue 1492803004: exo: Add SetGeometry function to ShellSurface class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@exosphere-xdg-shell
Patch Set: implement xdg_surface_set_window_geometry Created 5 years 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') | components/exo/wayland/server.cc » ('j') | 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"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 // Post a task that will destroy the shell surface and then start an 111 // Post a task that will destroy the shell surface and then start an
112 // interactive move. The interactive move should end when surface is 112 // interactive move. The interactive move should end when surface is
113 // destroyed. 113 // destroyed.
114 base::MessageLoopForUI::current()->PostTask( 114 base::MessageLoopForUI::current()->PostTask(
115 FROM_HERE, 115 FROM_HERE,
116 base::Bind(&DestroyShellSurface, base::Unretained(&shell_surface))); 116 base::Bind(&DestroyShellSurface, base::Unretained(&shell_surface)));
117 shell_surface->Move(); 117 shell_surface->Move();
118 } 118 }
119 119
120 TEST_F(ShellSurfaceTest, SetGeometry) {
121 gfx::Size buffer_size(64, 64);
122 scoped_ptr<Buffer> buffer(new Buffer(
123 exo_test_helper()->CreateGpuMemoryBuffer(buffer_size), GL_TEXTURE_2D));
124 scoped_ptr<Surface> surface(new Surface);
125 scoped_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
126
127 shell_surface->SetToplevel();
128 gfx::Rect geometry(16, 16, 32, 32);
129 shell_surface->SetGeometry(geometry);
130 surface->Attach(buffer.get());
131 surface->Commit();
132 EXPECT_EQ(
133 geometry.size().ToString(),
134 shell_surface->GetWidget()->GetWindowBoundsInScreen().size().ToString());
135 EXPECT_EQ(gfx::Rect(gfx::Point() - geometry.OffsetFromOrigin(), buffer_size)
136 .ToString(),
137 surface->bounds().ToString());
138 }
139
120 } // namespace 140 } // namespace
121 } // namespace exo 141 } // namespace exo
OLDNEW
« no previous file with comments | « components/exo/shell_surface.cc ('k') | components/exo/wayland/server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698