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

Side by Side Diff: ash/wm/frame_painter_unittest.cc

Issue 11030017: Add context to gfx::Screen calls in support of simultaneous desktop+ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix new addition Created 8 years, 2 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 | « ash/wm/frame_painter.cc ('k') | ash/wm/gestures/bezel_gesture_handler.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 "ash/wm/frame_painter.h" 5 #include "ash/wm/frame_painter.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "ash/test/ash_test_base.h" 9 #include "ash/test/ash_test_base.h"
10 #include "ash/wm/property_util.h" 10 #include "ash/wm/property_util.h"
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 TEST_F(FramePainterTest, HitTestSpecialMaximizedModes) { 329 TEST_F(FramePainterTest, HitTestSpecialMaximizedModes) {
330 // Create a widget and a painter for it. 330 // Create a widget and a painter for it.
331 scoped_ptr<Widget> w1(CreateResizableWidget()); 331 scoped_ptr<Widget> w1(CreateResizableWidget());
332 FramePainter p1; 332 FramePainter p1;
333 ImageButton size1(NULL); 333 ImageButton size1(NULL);
334 ImageButton close1(NULL); 334 ImageButton close1(NULL);
335 p1.Init(w1.get(), NULL, &size1, &close1, FramePainter::SIZE_BUTTON_MAXIMIZES); 335 p1.Init(w1.get(), NULL, &size1, &close1, FramePainter::SIZE_BUTTON_MAXIMIZES);
336 views::NonClientFrameView* frame = w1->non_client_view()->frame_view(); 336 views::NonClientFrameView* frame = w1->non_client_view()->frame_view();
337 w1->Show(); 337 w1->Show();
338 gfx::Rect any_rect = gfx::Rect(0, 0, 100, 100); 338 gfx::Rect any_rect = gfx::Rect(0, 0, 100, 100);
339 gfx::Rect screen = gfx::Screen::GetDisplayMatching(any_rect).work_area(); 339 gfx::Rect screen = Shell::GetScreen()->GetDisplayMatching(
340 any_rect).work_area();
340 w1->SetBounds(any_rect); 341 w1->SetBounds(any_rect);
341 EXPECT_EQ(HTTOPLEFT, p1.NonClientHitTest(frame, gfx::Point(0, 15))); 342 EXPECT_EQ(HTTOPLEFT, p1.NonClientHitTest(frame, gfx::Point(0, 15)));
342 w1->SetBounds(gfx::Rect( 343 w1->SetBounds(gfx::Rect(
343 screen.x(), screen.y(), screen.width() / 2, screen.height())); 344 screen.x(), screen.y(), screen.width() / 2, screen.height()));
344 // A hit without a set restore rect should produce a top left hit. 345 // A hit without a set restore rect should produce a top left hit.
345 EXPECT_EQ(HTTOPLEFT, p1.NonClientHitTest(frame, gfx::Point(0, 15))); 346 EXPECT_EQ(HTTOPLEFT, p1.NonClientHitTest(frame, gfx::Point(0, 15)));
346 ash::SetRestoreBoundsInScreen(w1->GetNativeWindow(), any_rect); 347 ash::SetRestoreBoundsInScreen(w1->GetNativeWindow(), any_rect);
347 // A hit into the corner should produce nowhere - not left. 348 // A hit into the corner should produce nowhere - not left.
348 EXPECT_EQ(HTCAPTION, p1.NonClientHitTest(frame, gfx::Point(0, 15))); 349 EXPECT_EQ(HTCAPTION, p1.NonClientHitTest(frame, gfx::Point(0, 15)));
349 // A hit into the middle upper area should generate right - not top&right. 350 // A hit into the middle upper area should generate right - not top&right.
350 EXPECT_EQ(HTRIGHT, 351 EXPECT_EQ(HTRIGHT,
351 p1.NonClientHitTest(frame, gfx::Point(screen.width() / 2, 15))); 352 p1.NonClientHitTest(frame, gfx::Point(screen.width() / 2, 15)));
352 // A hit into the middle should generate right. 353 // A hit into the middle should generate right.
353 EXPECT_EQ(HTRIGHT, 354 EXPECT_EQ(HTRIGHT,
354 p1.NonClientHitTest(frame, gfx::Point(screen.width() / 2, 355 p1.NonClientHitTest(frame, gfx::Point(screen.width() / 2,
355 screen.height() / 2))); 356 screen.height() / 2)));
356 // A hit into the middle lower area should generate right - not bottom&right. 357 // A hit into the middle lower area should generate right - not bottom&right.
357 EXPECT_EQ(HTRIGHT, 358 EXPECT_EQ(HTRIGHT,
358 p1.NonClientHitTest(frame, gfx::Point(screen.width() / 2, 359 p1.NonClientHitTest(frame, gfx::Point(screen.width() / 2,
359 screen.height() - 1))); 360 screen.height() - 1)));
360 } 361 }
361 362
362 } // namespace ash 363 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/frame_painter.cc ('k') | ash/wm/gestures/bezel_gesture_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698