Chromium Code Reviews| Index: chrome/browser/ui/views/frame/app_non_client_frame_view_aura_browsertest.cc |
| diff --git a/chrome/browser/ui/views/frame/app_non_client_frame_view_aura_browsertest.cc b/chrome/browser/ui/views/frame/app_non_client_frame_view_aura_browsertest.cc |
| index 46de1bf2b7cb310acf0e5250eda3dfb8dcd69ff5..4fe508e240d88075fed9cdbd3285ff122913cd85 100644 |
| --- a/chrome/browser/ui/views/frame/app_non_client_frame_view_aura_browsertest.cc |
| +++ b/chrome/browser/ui/views/frame/app_non_client_frame_view_aura_browsertest.cc |
| @@ -2,6 +2,7 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +#include "ash/wm/window_util.h" |
| #include "chrome/browser/ui/browser.h" |
| #include "chrome/browser/ui/browser_finder.h" |
| #include "chrome/browser/ui/browser_list.h" |
| @@ -20,13 +21,17 @@ using aura::Window; |
| namespace { |
| -bool HasChildWindowNamed(Window* window, const char* name) { |
| +Window* GetChildWindowNamed(Window* window, const char* name) { |
| for (size_t i = 0; i < window->children().size(); ++i) { |
| Window* child = window->children()[i]; |
| if (child->name() == name) |
| - return true; |
| + return child; |
| } |
| - return false; |
| + return NULL; |
| +} |
| + |
| +bool HasChildWindowNamed(Window* window, const char* name) { |
| + return GetChildWindowNamed(window, name) != NULL; |
| } |
| } // namespace |
| @@ -129,3 +134,35 @@ IN_PROC_BROWSER_TEST_F(AppNonClientFrameViewAuraTest, SnapLeftClosesControls) { |
| EXPECT_FALSE(HasChildWindowNamed( |
| native_window, AppNonClientFrameViewAura::kControlWindowName)); |
| } |
| + |
| +// Ensure that the controls are at the proper locations. |
| +IN_PROC_BROWSER_TEST_F(AppNonClientFrameViewAuraTest, ControlsAtRightSide) { |
| + aura::RootWindow* root_window = GetRootWindow(); |
| + aura::test::EventGenerator eg(root_window); |
| + aura::Window* native_window = app_browser()->window()->GetNativeWindow(); |
| + |
| + // Control window exists. |
| + aura::Window* window = GetChildWindowNamed( |
| + native_window, AppNonClientFrameViewAura::kControlWindowName); |
| + |
| + EXPECT_TRUE(window); |
|
sky
2012/09/25 18:39:49
ASSERT_TRUE. Use expect if a failure won't be fata
Mr4D (OOO till 08-26)
2012/09/25 20:30:34
Ah! Didn't know and will keep it in mind. Done.
|
| + gfx::Rect rect = window->bounds(); |
| + EXPECT_EQ(1280, rect.right()); |
|
sky
2012/09/25 18:39:49
Why does this need to be 1280 here? The important
Mr4D (OOO till 08-26)
2012/09/25 20:30:34
I thought that this would be fixed for the unit te
|
| + EXPECT_EQ(0, rect.y()); |
| + |
| + ash::wm::MinimizeWindow(native_window); |
| + content::RunAllPendingInMessageLoop(); |
|
sky
2012/09/25 18:39:49
Why do you need to runall pending here and below?
Mr4D (OOO till 08-26)
2012/09/25 20:30:34
I did try them before without and it failed. It ap
|
| + window = GetChildWindowNamed( |
|
sky
2012/09/25 18:39:49
Your test would be more readable if you don't reus
Mr4D (OOO till 08-26)
2012/09/25 20:30:34
I disagree here - but you get it. Done.
|
| + native_window, AppNonClientFrameViewAura::kControlWindowName); |
| + EXPECT_FALSE(window); |
| + ash::wm::MaximizeWindow(native_window); |
| + content::RunAllPendingInMessageLoop(); |
| + |
| + // Control window exists. |
| + window = GetChildWindowNamed( |
| + native_window, AppNonClientFrameViewAura::kControlWindowName); |
| + EXPECT_TRUE(window); |
|
sky
2012/09/25 18:39:49
ASSERT_TRUE
Mr4D (OOO till 08-26)
2012/09/25 20:30:34
Done.
|
| + rect = window->bounds(); |
| + EXPECT_EQ(1280, rect.right()); |
| + EXPECT_EQ(0, rect.y()); |
| +} |