Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(853)

Side by Side Diff: ash/test/ash_test_base.cc

Issue 10870036: Allow storing display preferences per device. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } 86 }
87 87
88 void AshTestBase::UpdateDisplay(const std::string& display_specs) { 88 void AshTestBase::UpdateDisplay(const std::string& display_specs) {
89 std::vector<gfx::Display> displays = CreateDisplaysFromString(display_specs); 89 std::vector<gfx::Display> displays = CreateDisplaysFromString(display_specs);
90 aura::Env::GetInstance()->display_manager()-> 90 aura::Env::GetInstance()->display_manager()->
91 OnNativeDisplaysChanged(displays); 91 OnNativeDisplaysChanged(displays);
92 92
93 // On non-testing environment, when a secondary display is connected, a new 93 // On non-testing environment, when a secondary display is connected, a new
94 // native (i.e. X) window for the display is always created below the previous 94 // native (i.e. X) window for the display is always created below the previous
95 // one for GPU performance reasons. Try to emulate the behavior. 95 // one for GPU performance reasons. Try to emulate the behavior.
96 if (internal::DisplayController::IsExtendedDesktopEnabled()) { 96 if (DisplayController::IsExtendedDesktopEnabled()) {
97 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 97 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
98 DCHECK_EQ(displays.size(), root_windows.size()); 98 DCHECK_EQ(displays.size(), root_windows.size());
99 size_t next_y = 0; 99 size_t next_y = 0;
100 for (size_t i = 0; i < root_windows.size(); ++i) { 100 for (size_t i = 0; i < root_windows.size(); ++i) {
101 const gfx::Size size = root_windows[i]->GetHostSize(); 101 const gfx::Size size = root_windows[i]->GetHostSize();
102 root_windows[i]->SetHostBounds(gfx::Rect(gfx::Point(0, next_y), size)); 102 root_windows[i]->SetHostBounds(gfx::Rect(gfx::Point(0, next_y), size));
103 next_y += size.height(); 103 next_y += size.height();
104 } 104 }
105 } 105 }
106 } 106 }
107 107
108 void AshTestBase::RunAllPendingInMessageLoop() { 108 void AshTestBase::RunAllPendingInMessageLoop() {
109 #if !defined(OS_MACOSX) 109 #if !defined(OS_MACOSX)
110 DCHECK(MessageLoopForUI::current() == &message_loop_); 110 DCHECK(MessageLoopForUI::current() == &message_loop_);
111 base::RunLoop run_loop(aura::Env::GetInstance()->GetDispatcher()); 111 base::RunLoop run_loop(aura::Env::GetInstance()->GetDispatcher());
112 run_loop.RunUntilIdle(); 112 run_loop.RunUntilIdle();
113 #endif 113 #endif
114 } 114 }
115 115
116 } // namespace test 116 } // namespace test
117 } // namespace ash 117 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698