OLD | NEW |
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/test/ash_test_base.h" | 5 #include "ash/test/ash_test_base.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/display/display_controller.h" | 10 #include "ash/display/display_controller.h" |
11 #include "ash/display/multi_display_manager.h" | 11 #include "ash/display/display_manager.h" |
12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
13 #include "ash/test/multi_display_manager_test_api.h" | 13 #include "ash/test/display_manager_test_api.h" |
14 #include "ash/test/test_shell_delegate.h" | 14 #include "ash/test/test_shell_delegate.h" |
15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
16 #include "content/public/test/web_contents_tester.h" | 16 #include "content/public/test/web_contents_tester.h" |
17 #include "ui/aura/env.h" | 17 #include "ui/aura/env.h" |
18 #include "ui/aura/display_manager.h" | |
19 #include "ui/aura/root_window.h" | 18 #include "ui/aura/root_window.h" |
20 #include "ui/base/ime/text_input_test_support.h" | 19 #include "ui/base/ime/text_input_test_support.h" |
21 #include "ui/compositor/layer_animator.h" | 20 #include "ui/compositor/layer_animator.h" |
22 #include "ui/gfx/display.h" | 21 #include "ui/gfx/display.h" |
23 #include "ui/gfx/screen.h" | 22 #include "ui/gfx/screen.h" |
24 | 23 |
25 namespace ash { | 24 namespace ash { |
26 namespace test { | 25 namespace test { |
27 | 26 |
28 content::WebContents* AshTestViewsDelegate::CreateWebContents( | 27 content::WebContents* AshTestViewsDelegate::CreateWebContents( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 ui::TextInputTestSupport::Shutdown(); | 62 ui::TextInputTestSupport::Shutdown(); |
64 } | 63 } |
65 | 64 |
66 void AshTestBase::ChangeDisplayConfig(float scale, | 65 void AshTestBase::ChangeDisplayConfig(float scale, |
67 const gfx::Rect& bounds_in_pixel) { | 66 const gfx::Rect& bounds_in_pixel) { |
68 gfx::Display display = | 67 gfx::Display display = |
69 gfx::Display(Shell::GetScreen()->GetPrimaryDisplay().id()); | 68 gfx::Display(Shell::GetScreen()->GetPrimaryDisplay().id()); |
70 display.SetScaleAndBounds(scale, bounds_in_pixel); | 69 display.SetScaleAndBounds(scale, bounds_in_pixel); |
71 std::vector<gfx::Display> displays; | 70 std::vector<gfx::Display> displays; |
72 displays.push_back(display); | 71 displays.push_back(display); |
73 aura::Env::GetInstance()->display_manager()->OnNativeDisplaysChanged( | 72 Shell::GetInstance()->display_manager()->OnNativeDisplaysChanged(displays); |
74 displays); | |
75 } | 73 } |
76 | 74 |
77 void AshTestBase::UpdateDisplay(const std::string& display_specs) { | 75 void AshTestBase::UpdateDisplay(const std::string& display_specs) { |
78 internal::MultiDisplayManager* multi_display_manager = | 76 DisplayManagerTestApi display_manager_test_api( |
79 static_cast<internal::MultiDisplayManager*>( | 77 Shell::GetInstance()->display_manager()); |
80 aura::Env::GetInstance()->display_manager()); | 78 display_manager_test_api.UpdateDisplay(display_specs); |
81 MultiDisplayManagerTestApi multi_display_manager_test_api( | |
82 multi_display_manager); | |
83 multi_display_manager_test_api.UpdateDisplay(display_specs); | |
84 } | 79 } |
85 | 80 |
86 void AshTestBase::RunAllPendingInMessageLoop() { | 81 void AshTestBase::RunAllPendingInMessageLoop() { |
87 #if !defined(OS_MACOSX) | 82 #if !defined(OS_MACOSX) |
88 DCHECK(MessageLoopForUI::current() == &message_loop_); | 83 DCHECK(MessageLoopForUI::current() == &message_loop_); |
89 base::RunLoop run_loop(aura::Env::GetInstance()->GetDispatcher()); | 84 base::RunLoop run_loop(aura::Env::GetInstance()->GetDispatcher()); |
90 run_loop.RunUntilIdle(); | 85 run_loop.RunUntilIdle(); |
91 #endif | 86 #endif |
92 } | 87 } |
93 | 88 |
94 void AshTestBase::SetSessionStarted(bool session_started) { | 89 void AshTestBase::SetSessionStarted(bool session_started) { |
95 test_shell_delegate_->SetSessionStarted(session_started); | 90 test_shell_delegate_->SetSessionStarted(session_started); |
96 } | 91 } |
97 | 92 |
98 void AshTestBase::SetUserLoggedIn(bool user_logged_in) { | 93 void AshTestBase::SetUserLoggedIn(bool user_logged_in) { |
99 test_shell_delegate_->SetUserLoggedIn(user_logged_in); | 94 test_shell_delegate_->SetUserLoggedIn(user_logged_in); |
100 } | 95 } |
101 | 96 |
102 } // namespace test | 97 } // namespace test |
103 } // namespace ash | 98 } // namespace ash |
OLD | NEW |