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

Side by Side Diff: components/mus/ws/window_manager_client_apptest.cc

Issue 1419793006: Makes windowmanager draw non-client area (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add include 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/mus/ws/server_window_observer.h ('k') | components/mus/ws/window_tree_apptest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/bind.h" 5 #include "base/bind.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "components/mus/public/cpp/tests/window_server_test_base.h" 8 #include "components/mus/public/cpp/tests/window_server_test_base.h"
9 #include "components/mus/public/cpp/util.h" 9 #include "components/mus/public/cpp/util.h"
10 #include "components/mus/public/cpp/window_observer.h" 10 #include "components/mus/public/cpp/window_observer.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 class ClientAreaChangeObserver : public WindowObserver { 54 class ClientAreaChangeObserver : public WindowObserver {
55 public: 55 public:
56 explicit ClientAreaChangeObserver(Window* window) : window_(window) { 56 explicit ClientAreaChangeObserver(Window* window) : window_(window) {
57 window_->AddObserver(this); 57 window_->AddObserver(this);
58 } 58 }
59 ~ClientAreaChangeObserver() override { window_->RemoveObserver(this); } 59 ~ClientAreaChangeObserver() override { window_->RemoveObserver(this); }
60 60
61 private: 61 private:
62 // Overridden from WindowObserver: 62 // Overridden from WindowObserver:
63 void OnWindowClientAreaChanged(Window* window, 63 void OnWindowClientAreaChanged(Window* window,
64 const gfx::Rect& old_client_area) override { 64 const gfx::Insets& old_client_area) override {
65 DCHECK_EQ(window, window_); 65 DCHECK_EQ(window, window_);
66 EXPECT_TRUE(WindowServerTestBase::QuitRunLoop()); 66 EXPECT_TRUE(WindowServerTestBase::QuitRunLoop());
67 } 67 }
68 68
69 Window* window_; 69 Window* window_;
70 70
71 MOJO_DISALLOW_COPY_AND_ASSIGN(ClientAreaChangeObserver); 71 MOJO_DISALLOW_COPY_AND_ASSIGN(ClientAreaChangeObserver);
72 }; 72 };
73 73
74 // Wait until the bounds of the supplied window change; returns false on 74 // Wait until the bounds of the supplied window change; returns false on
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 EXPECT_EQ(result4.connection_id, result4.connection->GetConnectionId()); 872 EXPECT_EQ(result4.connection_id, result4.connection->GetConnectionId());
873 } 873 }
874 874
875 TEST_F(WindowServerTest, ClientAreaChanged) { 875 TEST_F(WindowServerTest, ClientAreaChanged) {
876 Window* embed_window = window_manager()->NewWindow(); 876 Window* embed_window = window_manager()->NewWindow();
877 window_manager()->GetRoot()->AddChild(embed_window); 877 window_manager()->GetRoot()->AddChild(embed_window);
878 878
879 WindowTreeConnection* embedded_connection = Embed(embed_window).connection; 879 WindowTreeConnection* embedded_connection = Embed(embed_window).connection;
880 880
881 // Verify change from embedded makes it to parent. 881 // Verify change from embedded makes it to parent.
882 embedded_connection->GetRoot()->SetClientArea(gfx::Rect(1, 2, 3, 4)); 882 embedded_connection->GetRoot()->SetClientArea(gfx::Insets(1, 2, 3, 4));
883 ASSERT_TRUE(WaitForClientAreaToChange(embed_window)); 883 ASSERT_TRUE(WaitForClientAreaToChange(embed_window));
884 EXPECT_TRUE(gfx::Rect(1, 2, 3, 4) == embed_window->client_area()); 884 EXPECT_TRUE(gfx::Insets(1, 2, 3, 4) == embed_window->client_area());
885 885
886 // Verify bounds change results in resetting client area in embedded. 886 // Changing bounds shouldn't effect client area.
887 embed_window->SetBounds(gfx::Rect(21, 22, 23, 24)); 887 embed_window->SetBounds(gfx::Rect(21, 22, 23, 24));
888 WaitForBoundsToChange(embedded_connection->GetRoot()); 888 WaitForBoundsToChange(embedded_connection->GetRoot());
889 EXPECT_TRUE(gfx::Rect(21, 22, 23, 24) == 889 EXPECT_TRUE(gfx::Rect(21, 22, 23, 24) ==
890 embedded_connection->GetRoot()->bounds()); 890 embedded_connection->GetRoot()->bounds());
891 EXPECT_TRUE(gfx::Rect(0, 0, 23, 24) == 891 EXPECT_TRUE(gfx::Insets(1, 2, 3, 4) ==
892 embedded_connection->GetRoot()->client_area()); 892 embedded_connection->GetRoot()->client_area());
893 } 893 }
894 894
895 } // namespace ws 895 } // namespace ws
896 896
897 } // namespace mus 897 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/server_window_observer.h ('k') | components/mus/ws/window_tree_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698