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/common/test/test_session_state_delegate.h" | 10 #include "ash/common/test/test_session_state_delegate.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 private: | 83 private: |
84 DISALLOW_COPY_AND_ASSIGN(AshEventGeneratorDelegate); | 84 DISALLOW_COPY_AND_ASSIGN(AshEventGeneratorDelegate); |
85 }; | 85 }; |
86 | 86 |
87 } // namespace | 87 } // namespace |
88 | 88 |
89 ///////////////////////////////////////////////////////////////////////////// | 89 ///////////////////////////////////////////////////////////////////////////// |
90 | 90 |
91 AshTestBase::AshTestBase() | 91 AshTestBase::AshTestBase() |
92 : setup_called_(false), | 92 : setup_called_(false), teardown_called_(false), start_session_(true) { |
93 teardown_called_(false), | |
94 start_session_(true), | |
95 material_mode_(MaterialDesignController::Mode::UNINITIALIZED) { | |
96 #if defined(USE_X11) | 93 #if defined(USE_X11) |
97 // This is needed for tests which use this base class but are run in browser | 94 // This is needed for tests which use this base class but are run in browser |
98 // test binaries so don't get the default initialization in the unit test | 95 // test binaries so don't get the default initialization in the unit test |
99 // suite. | 96 // suite. |
100 gfx::InitializeThreadedX11(); | 97 gfx::InitializeThreadedX11(); |
101 #endif | 98 #endif |
102 | 99 |
103 ash_test_environment_ = AshTestEnvironment::Create(); | 100 ash_test_environment_ = AshTestEnvironment::Create(); |
104 | 101 |
105 // Must initialize |ash_test_helper_| here because some tests rely on | 102 // Must initialize |ash_test_helper_| here because some tests rely on |
(...skipping 17 matching lines...) Expand all Loading... |
123 | 120 |
124 // TODO(jamescook): Can we do this without changing command line? | 121 // TODO(jamescook): Can we do this without changing command line? |
125 // Use the origin (1,1) so that it doesn't over | 122 // Use the origin (1,1) so that it doesn't over |
126 // lap with the native mouse cursor. | 123 // lap with the native mouse cursor. |
127 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 124 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
128 if (!command_line->HasSwitch(::switches::kHostWindowBounds)) { | 125 if (!command_line->HasSwitch(::switches::kHostWindowBounds)) { |
129 command_line->AppendSwitchASCII(::switches::kHostWindowBounds, | 126 command_line->AppendSwitchASCII(::switches::kHostWindowBounds, |
130 "1+1-800x600"); | 127 "1+1-800x600"); |
131 } | 128 } |
132 | 129 |
133 ash_test_helper_->SetUp(start_session_, material_mode_); | 130 ash_test_helper_->SetUp(start_session_); |
134 | 131 |
135 Shell::GetPrimaryRootWindow()->Show(); | 132 Shell::GetPrimaryRootWindow()->Show(); |
136 Shell::GetPrimaryRootWindow()->GetHost()->Show(); | 133 Shell::GetPrimaryRootWindow()->GetHost()->Show(); |
137 // Move the mouse cursor to far away so that native events doesn't | 134 // Move the mouse cursor to far away so that native events doesn't |
138 // interfere test expectations. | 135 // interfere test expectations. |
139 Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000)); | 136 Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000)); |
140 Shell::GetInstance()->cursor_manager()->EnableMouseEvents(); | 137 Shell::GetInstance()->cursor_manager()->EnableMouseEvents(); |
141 | 138 |
142 // Changing GestureConfiguration shouldn't make tests fail. These values | 139 // Changing GestureConfiguration shouldn't make tests fail. These values |
143 // prevent unexpected events from being generated during tests. Such as | 140 // prevent unexpected events from being generated during tests. Such as |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 | 383 |
387 void AshTestBase::SwapPrimaryDisplay() { | 384 void AshTestBase::SwapPrimaryDisplay() { |
388 if (display::Screen::GetScreen()->GetNumDisplays() <= 1) | 385 if (display::Screen::GetScreen()->GetNumDisplays() <= 1) |
389 return; | 386 return; |
390 Shell::GetInstance()->window_tree_host_manager()->SetPrimaryDisplayId( | 387 Shell::GetInstance()->window_tree_host_manager()->SetPrimaryDisplayId( |
391 display_manager()->GetSecondaryDisplay().id()); | 388 display_manager()->GetSecondaryDisplay().id()); |
392 } | 389 } |
393 | 390 |
394 } // namespace test | 391 } // namespace test |
395 } // namespace ash | 392 } // namespace ash |
OLD | NEW |