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

Side by Side Diff: ui/aura/window_unittest.cc

Issue 10795013: Rename bounds accessors to be intuitive and consistent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « ui/aura/window.cc ('k') | ui/oak/oak_aura_window_display.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/aura/window.h" 5 #include "ui/aura/window.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 EXPECT_TRUE(window->HasCapture()); 927 EXPECT_TRUE(window->HasCapture());
928 928
929 // Destroy the window. 929 // Destroy the window.
930 window.reset(); 930 window.reset();
931 931
932 // Make sure the root window doesn't reference the window anymore. 932 // Make sure the root window doesn't reference the window anymore.
933 EXPECT_EQ(NULL, root_window()->mouse_pressed_handler()); 933 EXPECT_EQ(NULL, root_window()->mouse_pressed_handler());
934 EXPECT_EQ(NULL, aura::client::GetCaptureWindow(root_window())); 934 EXPECT_EQ(NULL, aura::client::GetCaptureWindow(root_window()));
935 } 935 }
936 936
937 TEST_F(WindowTest, GetRootWindowBounds) { 937 TEST_F(WindowTest, GetBoundsInRootWindow) {
938 scoped_ptr<Window> viewport(CreateTestWindowWithBounds( 938 scoped_ptr<Window> viewport(CreateTestWindowWithBounds(
939 gfx::Rect(0, 0, 300, 300), NULL)); 939 gfx::Rect(0, 0, 300, 300), NULL));
940 scoped_ptr<Window> child(CreateTestWindowWithBounds( 940 scoped_ptr<Window> child(CreateTestWindowWithBounds(
941 gfx::Rect(0, 0, 100, 100), viewport.get())); 941 gfx::Rect(0, 0, 100, 100), viewport.get()));
942 // Sanity check. 942 // Sanity check.
943 EXPECT_EQ("0,0 100x100", child->GetRootWindowBounds().ToString()); 943 EXPECT_EQ("0,0 100x100", child->GetBoundsInRootWindow().ToString());
944 944
945 // The |child| window's screen bounds should move along with the |viewport|. 945 // The |child| window's screen bounds should move along with the |viewport|.
946 viewport->SetBounds(gfx::Rect(-100, -100, 300, 300)); 946 viewport->SetBounds(gfx::Rect(-100, -100, 300, 300));
947 EXPECT_EQ("-100,-100 100x100", child->GetRootWindowBounds().ToString()); 947 EXPECT_EQ("-100,-100 100x100", child->GetBoundsInRootWindow().ToString());
948 948
949 // The |child| window is moved to the 0,0 in screen coordinates. 949 // The |child| window is moved to the 0,0 in screen coordinates.
950 // |GetRootWindowBounds()| should return 0,0. 950 // |GetBoundsInRootWindow()| should return 0,0.
951 child->SetBounds(gfx::Rect(100, 100, 100, 100)); 951 child->SetBounds(gfx::Rect(100, 100, 100, 100));
952 EXPECT_EQ("0,0 100x100", child->GetRootWindowBounds().ToString()); 952 EXPECT_EQ("0,0 100x100", child->GetBoundsInRootWindow().ToString());
953 } 953 }
954 954
955 class MouseEnterExitWindowDelegate : public TestWindowDelegate { 955 class MouseEnterExitWindowDelegate : public TestWindowDelegate {
956 public: 956 public:
957 MouseEnterExitWindowDelegate() : entered_(false), exited_(false) {} 957 MouseEnterExitWindowDelegate() : entered_(false), exited_(false) {}
958 958
959 virtual bool OnMouseEvent(MouseEvent* event) OVERRIDE { 959 virtual bool OnMouseEvent(MouseEvent* event) OVERRIDE {
960 switch (event->type()) { 960 switch (event->type()) {
961 case ui::ET_MOUSE_ENTERED: 961 case ui::ET_MOUSE_ENTERED:
962 entered_ = true; 962 entered_ = true;
(...skipping 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after
2412 element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); 2412 element->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
2413 2413
2414 // No bounds changed notification at the end of animation since layer 2414 // No bounds changed notification at the end of animation since layer
2415 // delegate is NULL. 2415 // delegate is NULL.
2416 EXPECT_FALSE(delegate.bounds_changed()); 2416 EXPECT_FALSE(delegate.bounds_changed());
2417 EXPECT_NE("0,0 100x100", window->bounds().ToString()); 2417 EXPECT_NE("0,0 100x100", window->bounds().ToString());
2418 } 2418 }
2419 2419
2420 } // namespace test 2420 } // namespace test
2421 } // namespace aura 2421 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/window.cc ('k') | ui/oak/oak_aura_window_display.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698