OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/header_painter.h" | 5 #include "ash/wm/header_painter.h" |
6 | 6 |
7 #include "ash/ash_constants.h" | 7 #include "ash/ash_constants.h" |
8 #include "ash/root_window_settings.h" | 8 #include "ash/root_window_settings.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
11 #include "ash/test/ash_test_base.h" | 11 #include "ash/test/ash_test_base.h" |
12 #include "ash/wm/caption_buttons/frame_caption_button_container_view.h" | 12 #include "ash/wm/caption_buttons/frame_caption_button_container_view.h" |
13 #include "ash/wm/window_state.h" | 13 #include "ash/wm/window_state.h" |
14 #include "ash/wm/window_util.h" | 14 #include "ash/wm/window_util.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
17 #include "grit/ash_resources.h" | 17 #include "grit/ash_resources.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "ui/aura/client/aura_constants.h" | 19 #include "ui/aura/client/aura_constants.h" |
| 20 #include "ui/aura/client/window_tree_client.h" |
20 #include "ui/aura/root_window.h" | 21 #include "ui/aura/root_window.h" |
21 #include "ui/aura/window_observer.h" | 22 #include "ui/aura/window_observer.h" |
22 #include "ui/base/hit_test.h" | 23 #include "ui/base/hit_test.h" |
23 #include "ui/gfx/font.h" | 24 #include "ui/gfx/font.h" |
24 #include "ui/gfx/screen.h" | 25 #include "ui/gfx/screen.h" |
25 #include "ui/views/widget/widget.h" | 26 #include "ui/views/widget/widget.h" |
26 #include "ui/views/widget/widget_delegate.h" | 27 #include "ui/views/widget/widget_delegate.h" |
27 #include "ui/views/widget/widget_observer.h" | 28 #include "ui/views/widget/widget_observer.h" |
28 #include "ui/views/window/non_client_view.h" | 29 #include "ui/views/window/non_client_view.h" |
29 | 30 |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 scoped_ptr<HeaderPainter> painter(CreateTestPainter(widget.get())); | 389 scoped_ptr<HeaderPainter> painter(CreateTestPainter(widget.get())); |
389 widget->Show(); | 390 widget->Show(); |
390 | 391 |
391 // We only have one window, so it should use a solo header. | 392 // We only have one window, so it should use a solo header. |
392 EXPECT_TRUE(painter->UseSoloWindowHeader()); | 393 EXPECT_TRUE(painter->UseSoloWindowHeader()); |
393 | 394 |
394 // Create non-drawing window similar to DragDropTracker. | 395 // Create non-drawing window similar to DragDropTracker. |
395 scoped_ptr<aura::Window> window(new aura::Window(NULL)); | 396 scoped_ptr<aura::Window> window(new aura::Window(NULL)); |
396 window->SetType(aura::client::WINDOW_TYPE_NORMAL); | 397 window->SetType(aura::client::WINDOW_TYPE_NORMAL); |
397 window->Init(ui::LAYER_NOT_DRAWN); | 398 window->Init(ui::LAYER_NOT_DRAWN); |
398 window->SetDefaultParentByRootWindow( | 399 aura::client::ParentWindowWithContext(window.get(), widget->GetNativeWindow(), |
399 widget->GetNativeWindow()->GetRootWindow(), gfx::Rect()); | 400 gfx::Rect()); |
400 window->Show(); | 401 window->Show(); |
401 | 402 |
402 // Despite two windows, the first window should still be considered "solo" | 403 // Despite two windows, the first window should still be considered "solo" |
403 // because non-drawing windows aren't included in the computation. | 404 // because non-drawing windows aren't included in the computation. |
404 EXPECT_TRUE(painter->UseSoloWindowHeader()); | 405 EXPECT_TRUE(painter->UseSoloWindowHeader()); |
405 } | 406 } |
406 | 407 |
407 #if defined(OS_WIN) | 408 #if defined(OS_WIN) |
408 // Multiple displays are not supported on Windows Ash. http://crbug.com/165962 | 409 // Multiple displays are not supported on Windows Ash. http://crbug.com/165962 |
409 #define MAYBE_UseSoloWindowHeaderMultiDisplay \ | 410 #define MAYBE_UseSoloWindowHeaderMultiDisplay \ |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 HeaderPainterOwner* o2 = new HeaderPainterOwner(w2); | 657 HeaderPainterOwner* o2 = new HeaderPainterOwner(w2); |
657 HeaderPainter* p2 = o2->header_painter(); | 658 HeaderPainter* p2 = o2->header_painter(); |
658 w2->Show(); | 659 w2->Show(); |
659 EXPECT_FALSE(p1->UseSoloWindowHeader()); | 660 EXPECT_FALSE(p1->UseSoloWindowHeader()); |
660 EXPECT_FALSE(p2->UseSoloWindowHeader()); | 661 EXPECT_FALSE(p2->UseSoloWindowHeader()); |
661 | 662 |
662 // Exit with no resource release. They'll be released at shutdown. | 663 // Exit with no resource release. They'll be released at shutdown. |
663 } | 664 } |
664 | 665 |
665 } // namespace ash | 666 } // namespace ash |
OLD | NEW |