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

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

Issue 11428066: Use WS_POPUP for ash_unittests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years 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
« no previous file with comments | « ash/test/ash_test_base.cc ('k') | ash/wm/workspace/workspace_window_resizer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/display_manager_test_api.h" 5 #include "ash/test/display_manager_test_api.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/display/display_manager.h" 9 #include "ash/display/display_manager.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 23 matching lines...) Expand all
34 DisplayManagerTestApi::DisplayManagerTestApi( 34 DisplayManagerTestApi::DisplayManagerTestApi(
35 internal::DisplayManager* display_manager) 35 internal::DisplayManager* display_manager)
36 : display_manager_(display_manager) { 36 : display_manager_(display_manager) {
37 } 37 }
38 38
39 DisplayManagerTestApi::~DisplayManagerTestApi() {} 39 DisplayManagerTestApi::~DisplayManagerTestApi() {}
40 40
41 void DisplayManagerTestApi::UpdateDisplay( 41 void DisplayManagerTestApi::UpdateDisplay(
42 const std::string& display_specs) { 42 const std::string& display_specs) {
43 std::vector<gfx::Display> displays = CreateDisplaysFromString(display_specs); 43 std::vector<gfx::Display> displays = CreateDisplaysFromString(display_specs);
44 display_manager_->SetDisplayIdsForTest(&displays);
45 display_manager_->OnNativeDisplaysChanged(displays);
46
47 bool is_host_origin_set = false; 44 bool is_host_origin_set = false;
48 for (size_t i = 0; i < displays.size(); ++i) { 45 for (size_t i = 0; i < displays.size(); ++i) {
49 if (displays[i].bounds_in_pixel().origin() != gfx::Point(0, 0)) { 46 if (displays[i].bounds_in_pixel().origin() != gfx::Point(0, 0)) {
50 is_host_origin_set = true; 47 is_host_origin_set = true;
51 break; 48 break;
52 } 49 }
53 } 50 }
54 51
55 // On non-testing environment, when a secondary display is connected, a new 52 // On non-testing environment, when a secondary display is connected, a new
56 // native (i.e. X) window for the display is always created below the 53 // native (i.e. X) window for the display is always created below the
57 // previous one for GPU performance reasons. Try to emulate the behavior 54 // previous one for GPU performance reasons. Try to emulate the behavior
58 // unless host origins are explicitly set. 55 // unless host origins are explicitly set.
59 if (!is_host_origin_set) { 56 if (!is_host_origin_set) {
60 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 57 // Sart from (1,1) so that windows won't overlap with native mouse cursor.
61 int next_y = 0; 58 // See |AshTestBase::SetUp()|.
62 for (size_t i = 0; i < root_windows.size(); ++i) { 59 int next_y = 1;
63 const gfx::Size size = root_windows[i]->GetHostSize(); 60 for (std::vector<gfx::Display>::iterator iter = displays.begin();
64 root_windows[i]->SetHostBounds(gfx::Rect(gfx::Point(0, next_y), size)); 61 iter != displays.end(); ++iter) {
65 next_y += size.height(); 62 gfx::Rect bounds(iter->GetSizeInPixel());
63 bounds.set_x(1);
64 bounds.set_y(next_y);
65 next_y += bounds.height();
66 iter->SetScaleAndBounds(iter->device_scale_factor(), bounds);
66 } 67 }
67 } 68 }
69
70 display_manager_->SetDisplayIdsForTest(&displays);
71 display_manager_->OnNativeDisplaysChanged(displays);
68 } 72 }
69 73
70 } // namespace test 74 } // namespace test
71 } // namespace ash 75 } // namespace ash
OLDNEW
« no previous file with comments | « ash/test/ash_test_base.cc ('k') | ash/wm/workspace/workspace_window_resizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698