| 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 "ui/aura/test/test_screen.h" | 5 #include "ui/aura/test/test_screen.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "ui/aura/env.h" | 10 #include "ui/aura/env.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 .CallWmNewDisplayAdded(GetPrimaryDisplay()); | 49 .CallWmNewDisplayAdded(GetPrimaryDisplay()); |
| 50 } else { | 50 } else { |
| 51 host_ = | 51 host_ = |
| 52 WindowTreeHost::Create(gfx::Rect(GetPrimaryDisplay().GetSizeInPixel())); | 52 WindowTreeHost::Create(gfx::Rect(GetPrimaryDisplay().GetSizeInPixel())); |
| 53 } | 53 } |
| 54 // Some tests don't correctly manage window focus/activation states. | 54 // Some tests don't correctly manage window focus/activation states. |
| 55 // Makes sure InputMethod is default focused so that IME basics can work. | 55 // Makes sure InputMethod is default focused so that IME basics can work. |
| 56 host_->GetInputMethod()->OnFocus(); | 56 host_->GetInputMethod()->OnFocus(); |
| 57 host_->window()->AddObserver(this); | 57 host_->window()->AddObserver(this); |
| 58 host_->InitHost(); | 58 host_->InitHost(); |
| 59 host_->window()->Show(); |
| 59 return host_; | 60 return host_; |
| 60 } | 61 } |
| 61 | 62 |
| 62 void TestScreen::SetDeviceScaleFactor(float device_scale_factor) { | 63 void TestScreen::SetDeviceScaleFactor(float device_scale_factor) { |
| 63 display::Display display(GetPrimaryDisplay()); | 64 display::Display display(GetPrimaryDisplay()); |
| 64 gfx::Rect bounds_in_pixel(display.GetSizeInPixel()); | 65 gfx::Rect bounds_in_pixel(display.GetSizeInPixel()); |
| 65 display.SetScaleAndBounds(device_scale_factor, bounds_in_pixel); | 66 display.SetScaleAndBounds(device_scale_factor, bounds_in_pixel); |
| 66 display_list().UpdateDisplay(display); | 67 display_list().UpdateDisplay(display); |
| 67 host_->OnHostResizedInPixels(bounds_in_pixel.size()); | 68 host_->OnHostResizedInPixels(bounds_in_pixel.size()); |
| 68 } | 69 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 TestScreen::TestScreen(const gfx::Rect& screen_bounds, | 164 TestScreen::TestScreen(const gfx::Rect& screen_bounds, |
| 164 WindowTreeClient* window_tree_client) | 165 WindowTreeClient* window_tree_client) |
| 165 : host_(nullptr), ui_scale_(1.0f), window_tree_client_(window_tree_client) { | 166 : host_(nullptr), ui_scale_(1.0f), window_tree_client_(window_tree_client) { |
| 166 static int64_t synthesized_display_id = 2000; | 167 static int64_t synthesized_display_id = 2000; |
| 167 display::Display display(synthesized_display_id++); | 168 display::Display display(synthesized_display_id++); |
| 168 display.SetScaleAndBounds(1.0f, screen_bounds); | 169 display.SetScaleAndBounds(1.0f, screen_bounds); |
| 169 ProcessDisplayChanged(display, true /* is_primary */); | 170 ProcessDisplayChanged(display, true /* is_primary */); |
| 170 } | 171 } |
| 171 | 172 |
| 172 } // namespace aura | 173 } // namespace aura |
| OLD | NEW |