| 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/test/ash_test_helper.h" | 5 #include "ash/test/ash_test_helper.h" |
| 6 | 6 |
| 7 #include "ash/accelerators/accelerator_controller_delegate_aura.h" | 7 #include "ash/accelerators/accelerator_controller_delegate_aura.h" |
| 8 #include "ash/common/test/test_session_state_delegate.h" | 8 #include "ash/common/test/test_session_state_delegate.h" |
| 9 #include "ash/common/test/test_system_tray_delegate.h" | 9 #include "ash/common/test/test_system_tray_delegate.h" |
| 10 #include "ash/common/test/wm_shell_test_api.h" | 10 #include "ash/common/test/wm_shell_test_api.h" |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 228 |
| 229 aura::Window* AshTestHelper::CurrentContext() { | 229 aura::Window* AshTestHelper::CurrentContext() { |
| 230 aura::Window* root_window = Shell::GetTargetRootWindow(); | 230 aura::Window* root_window = Shell::GetTargetRootWindow(); |
| 231 if (!root_window) | 231 if (!root_window) |
| 232 root_window = Shell::GetPrimaryRootWindow(); | 232 root_window = Shell::GetPrimaryRootWindow(); |
| 233 DCHECK(root_window); | 233 DCHECK(root_window); |
| 234 return root_window; | 234 return root_window; |
| 235 } | 235 } |
| 236 | 236 |
| 237 void AshTestHelper::UpdateDisplayForMash(const std::string& display_spec) { | 237 void AshTestHelper::UpdateDisplayForMash(const std::string& display_spec) { |
| 238 // TODO(erg): This is not equivalent to display::DisplayManager:: |
| 239 // UpdateDisplaysWith(). This does not calculate all the internal metric |
| 240 // changes, does not calculate focus changes and does not dispatch to all the |
| 241 // observers in ash which want to be notified about the previous two. |
| 242 // |
| 243 // Once this is fixed, RootWindowControllerTest.MoveWindows_Basic, among |
| 244 // other unit tests, should work. http://crbug.com/695632. |
| 238 CHECK(IsMash()); | 245 CHECK(IsMash()); |
| 239 const std::vector<std::string> parts = base::SplitString( | 246 const std::vector<std::string> parts = base::SplitString( |
| 240 display_spec, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 247 display_spec, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 241 std::vector<RootWindowController*> root_window_controllers = | 248 std::vector<RootWindowController*> root_window_controllers = |
| 242 GetRootsOrderedByDisplayId(); | 249 GetRootsOrderedByDisplayId(); |
| 243 int next_x = 0; | 250 int next_x = 0; |
| 244 for (size_t i = 0, | 251 for (size_t i = 0, |
| 245 end = std::min(parts.size(), root_window_controllers.size()); | 252 end = std::min(parts.size(), root_window_controllers.size()); |
| 246 i < end; ++i) { | 253 i < end; ++i) { |
| 247 UpdateDisplay(root_window_controllers[i], parts[i], &next_x); | 254 UpdateDisplay(root_window_controllers[i], parts[i], &next_x); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 std::set<RootWindowController*> roots = | 364 std::set<RootWindowController*> roots = |
| 358 window_manager_app_->window_manager()->GetRootWindowControllers(); | 365 window_manager_app_->window_manager()->GetRootWindowControllers(); |
| 359 std::vector<RootWindowController*> ordered_roots; | 366 std::vector<RootWindowController*> ordered_roots; |
| 360 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end()); | 367 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end()); |
| 361 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId); | 368 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId); |
| 362 return ordered_roots; | 369 return ordered_roots; |
| 363 } | 370 } |
| 364 | 371 |
| 365 } // namespace test | 372 } // namespace test |
| 366 } // namespace ash | 373 } // namespace ash |
| OLD | NEW |