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

Side by Side Diff: chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc

Issue 292443002: linux_aura: Compile ash into chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src
Patch Set: Rebase to ToT Created 6 years, 7 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 | « chrome/browser/ui/window_sizer/window_sizer_ash_uitest.cc ('k') | chrome/chrome_browser.gypi » ('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/scoped_target_root_window.h" 5 #include "ash/scoped_target_root_window.h"
6 #include "ash/screen_util.h" 6 #include "ash/screen_util.h"
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/test/ash_test_base.h" 8 #include "ash/test/ash_test_base.h"
9 #include "ash/test/test_shell_delegate.h" 9 #include "ash/test/test_shell_delegate.h"
10 #include "ash/wm/window_positioner.h" 10 #include "ash/wm/window_positioner.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 if (!bounds.IsEmpty()) 85 if (!bounds.IsEmpty())
86 window->SetBounds(bounds); 86 window->SetBounds(bounds);
87 scoped_ptr<TestBrowserWindowAura> browser_window( 87 scoped_ptr<TestBrowserWindowAura> browser_window(
88 new TestBrowserWindowAura(window)); 88 new TestBrowserWindowAura(window));
89 browser_window->CreateBrowser(params); 89 browser_window->CreateBrowser(params);
90 return browser_window.Pass(); 90 return browser_window.Pass();
91 } 91 }
92 92
93 } // namespace 93 } // namespace
94 94
95 // On desktop linux aura, we currently don't use the ash frame, breaking some
96 // tests which expect ash sizes: http://crbug.com/303862
97 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
98 #define MAYBE_DefaultSizeCase DISABLED_DefaultSizeCase
99 #else
100 #define MAYBE_DefaultSizeCase DefaultSizeCase
101 #endif
102
95 // Test that the window is sized appropriately for the first run experience 103 // Test that the window is sized appropriately for the first run experience
96 // where the default window bounds calculation is invoked. 104 // where the default window bounds calculation is invoked.
97 TEST_F(WindowSizerAshTest, DefaultSizeCase) { 105 TEST_F(WindowSizerAshTest, MAYBE_DefaultSizeCase) {
98 #if defined(OS_WIN) 106 #if defined(OS_WIN)
99 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kOpenAsh); 107 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kOpenAsh);
100 #endif 108 #endif
101 { // 4:3 monitor case, 1024x768, no taskbar 109 { // 4:3 monitor case, 1024x768, no taskbar
102 gfx::Rect window_bounds; 110 gfx::Rect window_bounds;
103 GetWindowBounds(p1024x768, p1024x768, gfx::Rect(), gfx::Rect(), 111 GetWindowBounds(p1024x768, p1024x768, gfx::Rect(), gfx::Rect(),
104 gfx::Rect(), DEFAULT, NULL, gfx::Rect(), &window_bounds); 112 gfx::Rect(), DEFAULT, NULL, gfx::Rect(), &window_bounds);
105 EXPECT_EQ(gfx::Rect(ash::WindowPositioner::kDesktopBorderSize, 113 EXPECT_EQ(gfx::Rect(ash::WindowPositioner::kDesktopBorderSize,
106 ash::WindowPositioner::kDesktopBorderSize, 114 ash::WindowPositioner::kDesktopBorderSize,
107 1024 - ash::WindowPositioner::kDesktopBorderSize * 2, 115 1024 - ash::WindowPositioner::kDesktopBorderSize * 2,
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 gfx::Rect(985, 729, 500, 400), gfx::Rect(), LAST_ACTIVE, 452 gfx::Rect(985, 729, 500, 400), gfx::Rect(), LAST_ACTIVE,
445 NULL, gfx::Rect(), &window_bounds); 453 NULL, gfx::Rect(), &window_bounds);
446 EXPECT_EQ(gfx::Rect(994 /* not 995 */, 454 EXPECT_EQ(gfx::Rect(994 /* not 995 */,
447 738 /* not 739 */, 455 738 /* not 739 */,
448 500, 456 500,
449 400).ToString(), 457 400).ToString(),
450 window_bounds.ToString()); 458 window_bounds.ToString());
451 } 459 }
452 } 460 }
453 461
462 // On desktop linux aura, we currently don't use the ash frame, breaking some
463 // tests which expect ash sizes: http://crbug.com/303862
464 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
465 #define MAYBE_PlaceNewWindows DISABLED_PlaceNewWindows
466 #else
467 #define MAYBE_PlaceNewWindows PlaceNewWindows
468 #endif
469
454 // Test the placement of newly created windows. 470 // Test the placement of newly created windows.
455 TEST_F(WindowSizerAshTest, PlaceNewWindows) { 471 TEST_F(WindowSizerAshTest, MAYBE_PlaceNewWindows) {
456 // Create a browser which we can use to pass into the GetWindowBounds 472 // Create a browser which we can use to pass into the GetWindowBounds
457 // function. 473 // function.
458 scoped_ptr<TestingProfile> profile(new TestingProfile()); 474 scoped_ptr<TestingProfile> profile(new TestingProfile());
459 // Creating a popup handler here to make sure it does not interfere with the 475 // Creating a popup handler here to make sure it does not interfere with the
460 // existing windows. 476 // existing windows.
461 Browser::CreateParams native_params(profile.get(), 477 Browser::CreateParams native_params(profile.get(),
462 chrome::HOST_DESKTOP_TYPE_ASH); 478 chrome::HOST_DESKTOP_TYPE_ASH);
463 scoped_ptr<Browser> browser( 479 scoped_ptr<Browser> browser(
464 chrome::CreateBrowserWithTestWindowForParams(&native_params)); 480 chrome::CreateBrowserWithTestWindowForParams(&native_params));
465 481
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 std::max(ash::WindowPositioner::kDesktopBorderSize, 530 std::max(ash::WindowPositioner::kDesktopBorderSize,
515 (1600 - ash::WindowPositioner::kMaximumWindowWidth) / 2), 531 (1600 - ash::WindowPositioner::kMaximumWindowWidth) / 2),
516 ash::WindowPositioner::kDesktopBorderSize, 532 ash::WindowPositioner::kDesktopBorderSize,
517 std::min(ash::WindowPositioner::kMaximumWindowWidth, 533 std::min(ash::WindowPositioner::kMaximumWindowWidth,
518 1600 - 2 * ash::WindowPositioner::kDesktopBorderSize), 534 1600 - 2 * ash::WindowPositioner::kDesktopBorderSize),
519 1200 - ash::WindowPositioner::kDesktopBorderSize).ToString(), 535 1200 - ash::WindowPositioner::kDesktopBorderSize).ToString(),
520 window_bounds.ToString()); 536 window_bounds.ToString());
521 } 537 }
522 } 538 }
523 539
540 // On desktop linux aura, we currently don't use the ash frame, breaking some
541 // tests which expect ash sizes: http://crbug.com/303862
542 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
543 #define MAYBE_PlaceNewBrowserWindowOnEmptyDesktop DISABLED_PlaceNewBrowserWindow OnEmptyDesktop
544 #else
545 #define MAYBE_PlaceNewBrowserWindowOnEmptyDesktop PlaceNewBrowserWindowOnEmptyDe sktop
546 #endif
547
524 // Test the placement of newly created windows on an empty desktop. 548 // Test the placement of newly created windows on an empty desktop.
525 // This test supplements "PlaceNewWindows" by testing the creation of a newly 549 // This test supplements "PlaceNewWindows" by testing the creation of a newly
526 // created browser window on an empty desktop. 550 // created browser window on an empty desktop.
527 TEST_F(WindowSizerAshTest, PlaceNewBrowserWindowOnEmptyDesktop) { 551 TEST_F(WindowSizerAshTest, MAYBE_PlaceNewBrowserWindowOnEmptyDesktop) {
528 // Create a browser which we can use to pass into the GetWindowBounds 552 // Create a browser which we can use to pass into the GetWindowBounds
529 // function. 553 // function.
530 scoped_ptr<TestingProfile> profile(new TestingProfile()); 554 scoped_ptr<TestingProfile> profile(new TestingProfile());
531 Browser::CreateParams native_params(profile.get(), 555 Browser::CreateParams native_params(profile.get(),
532 chrome::HOST_DESKTOP_TYPE_ASH); 556 chrome::HOST_DESKTOP_TYPE_ASH);
533 scoped_ptr<Browser> browser( 557 scoped_ptr<Browser> browser(
534 chrome::CreateBrowserWithTestWindowForParams(&native_params)); 558 chrome::CreateBrowserWithTestWindowForParams(&native_params));
535 559
536 // A common screen size for Chrome OS devices where this behavior is 560 // A common screen size for Chrome OS devices where this behavior is
537 // desirable. 561 // desirable.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 gfx::Rect(), secondary_bounds, 712 gfx::Rect(), secondary_bounds,
689 PERSISTED, new_browser_window->browser(), 713 PERSISTED, new_browser_window->browser(),
690 gfx::Rect(), &window_bounds); 714 gfx::Rect(), &window_bounds);
691 // TODO(oshima): Use exact bounds when the window_sizer_ash is 715 // TODO(oshima): Use exact bounds when the window_sizer_ash is
692 // moved to ash and changed to include the result from 716 // moved to ash and changed to include the result from
693 // RearrangeVisibleWindowOnShow. 717 // RearrangeVisibleWindowOnShow.
694 EXPECT_TRUE(primary_bounds.Contains(window_bounds)); 718 EXPECT_TRUE(primary_bounds.Contains(window_bounds));
695 } 719 }
696 } 720 }
697 721
722 // On desktop linux aura, we currently don't use the ash frame, breaking some
723 // tests which expect ash sizes: http://crbug.com/303862
724 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
725 #define MAYBE_TestShowState DISABLED_TestShowState
726 #else
727 #define MAYBE_TestShowState TestShowState
728 #endif
729
698 // Test that the show state is properly returned for non default cases. 730 // Test that the show state is properly returned for non default cases.
699 TEST_F(WindowSizerAshTest, TestShowState) { 731 TEST_F(WindowSizerAshTest, MAYBE_TestShowState) {
700 scoped_ptr<TestingProfile> profile(new TestingProfile()); 732 scoped_ptr<TestingProfile> profile(new TestingProfile());
701 733
702 // Creating a browser & window to play with. 734 // Creating a browser & window to play with.
703 scoped_ptr<TestBrowserWindowAura> browser_window(CreateTestBrowserWindow( 735 scoped_ptr<TestBrowserWindowAura> browser_window(CreateTestBrowserWindow(
704 CreateTestWindowInShellWithId(0), 736 CreateTestWindowInShellWithId(0),
705 gfx::Rect(16, 32, 640, 320), 737 gfx::Rect(16, 32, 640, 320),
706 Browser::CreateParams(Browser::TYPE_TABBED, profile.get(), 738 Browser::CreateParams(Browser::TYPE_TABBED, profile.get(),
707 chrome::HOST_DESKTOP_TYPE_ASH))); 739 chrome::HOST_DESKTOP_TYPE_ASH)));
708 740
709 // Create also a popup browser since that behaves different. 741 // Create also a popup browser since that behaves different.
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 trusted_popup_create_params)); 941 trusted_popup_create_params));
910 // Trusted popup windows should follow the saved show state and ignore the 942 // Trusted popup windows should follow the saved show state and ignore the
911 // last show state. 943 // last show state.
912 EXPECT_EQ(ui::SHOW_STATE_DEFAULT, 944 EXPECT_EQ(ui::SHOW_STATE_DEFAULT,
913 GetWindowShowState(ui::SHOW_STATE_DEFAULT, 945 GetWindowShowState(ui::SHOW_STATE_DEFAULT,
914 ui::SHOW_STATE_NORMAL, 946 ui::SHOW_STATE_NORMAL,
915 BOTH, 947 BOTH,
916 trusted_popup->browser(), 948 trusted_popup->browser(),
917 p1600x1200)); 949 p1600x1200));
918 } 950 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/window_sizer/window_sizer_ash_uitest.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698