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

Side by Side Diff: ui/views_content_client/views_content_client_main_parts_chromeos.cc

Issue 2207043002: SetDeviceScaleFactorForTest Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: SetDeviceScaleFactorForTest Created 4 years, 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/macros.h" 5 #include "base/macros.h"
6 #include "content/public/browser/context_factory.h" 6 #include "content/public/browser/context_factory.h"
7 #include "content/shell/browser/shell_browser_context.h" 7 #include "content/shell/browser/shell_browser_context.h"
8 #include "ui/aura/test/test_screen.h"
9 #include "ui/aura/window.h" 8 #include "ui/aura/window.h"
10 #include "ui/display/screen.h" 9 #include "ui/display/screen.h"
11 #include "ui/views_content_client/views_content_client.h" 10 #include "ui/views_content_client/views_content_client.h"
12 #include "ui/views_content_client/views_content_client_main_parts_aura.h" 11 #include "ui/views_content_client/views_content_client_main_parts_aura.h"
13 #include "ui/wm/test/wm_test_helper.h" 12 #include "ui/wm/test/wm_test_helper.h"
14 13
15 namespace ui { 14 namespace ui {
16 15
17 namespace { 16 namespace {
18 17
19 class ViewsContentClientMainPartsChromeOS 18 class ViewsContentClientMainPartsChromeOS
20 : public ViewsContentClientMainPartsAura { 19 : public ViewsContentClientMainPartsAura {
21 public: 20 public:
22 ViewsContentClientMainPartsChromeOS( 21 ViewsContentClientMainPartsChromeOS(
23 const content::MainFunctionParams& content_params, 22 const content::MainFunctionParams& content_params,
24 ViewsContentClient* views_content_client); 23 ViewsContentClient* views_content_client);
25 ~ViewsContentClientMainPartsChromeOS() override {} 24 ~ViewsContentClientMainPartsChromeOS() override {}
26 25
27 // content::BrowserMainParts: 26 // content::BrowserMainParts:
28 void PreMainMessageLoopRun() override; 27 void PreMainMessageLoopRun() override;
29 void PostMainMessageLoopRun() override; 28 void PostMainMessageLoopRun() override;
30 29
31 private: 30 private:
32 // Enable a minimal set of views::corewm to be initialized. 31 // Enable a minimal set of views::corewm to be initialized.
33 std::unique_ptr<display::Screen> test_screen_;
34 std::unique_ptr<::wm::WMTestHelper> wm_test_helper_; 32 std::unique_ptr<::wm::WMTestHelper> wm_test_helper_;
35 33
36 DISALLOW_COPY_AND_ASSIGN(ViewsContentClientMainPartsChromeOS); 34 DISALLOW_COPY_AND_ASSIGN(ViewsContentClientMainPartsChromeOS);
37 }; 35 };
38 36
39 ViewsContentClientMainPartsChromeOS::ViewsContentClientMainPartsChromeOS( 37 ViewsContentClientMainPartsChromeOS::ViewsContentClientMainPartsChromeOS(
40 const content::MainFunctionParams& content_params, 38 const content::MainFunctionParams& content_params,
41 ViewsContentClient* views_content_client) 39 ViewsContentClient* views_content_client)
42 : ViewsContentClientMainPartsAura(content_params, views_content_client) { 40 : ViewsContentClientMainPartsAura(content_params, views_content_client) {
43 } 41 }
44 42
45 void ViewsContentClientMainPartsChromeOS::PreMainMessageLoopRun() { 43 void ViewsContentClientMainPartsChromeOS::PreMainMessageLoopRun() {
46 ViewsContentClientMainPartsAura::PreMainMessageLoopRun(); 44 ViewsContentClientMainPartsAura::PreMainMessageLoopRun();
47 45
48 gfx::Size host_size(800, 600); 46 gfx::Size host_size(800, 600);
49 test_screen_.reset(aura::TestScreen::Create(host_size));
50 display::Screen::SetScreenInstance(test_screen_.get());
51 // Set up basic pieces of views::corewm. 47 // Set up basic pieces of views::corewm.
52 wm_test_helper_.reset( 48 wm_test_helper_.reset(
53 new ::wm::WMTestHelper(host_size, content::GetContextFactory())); 49 new ::wm::WMTestHelper(host_size, content::GetContextFactory()));
54 // Ensure the X window gets mapped. 50 // Ensure the X window gets mapped.
55 wm_test_helper_->host()->Show(); 51 wm_test_helper_->host()->Show();
56 52
57 // Ensure Aura knows where to open new windows. 53 // Ensure Aura knows where to open new windows.
58 aura::Window* root_window = wm_test_helper_->host()->window(); 54 aura::Window* root_window = wm_test_helper_->host()->window();
59 views_content_client()->task().Run(browser_context(), root_window); 55 views_content_client()->task().Run(browser_context(), root_window);
60 } 56 }
61 57
62 void ViewsContentClientMainPartsChromeOS::PostMainMessageLoopRun() { 58 void ViewsContentClientMainPartsChromeOS::PostMainMessageLoopRun() {
63 wm_test_helper_.reset(); 59 wm_test_helper_.reset();
64 test_screen_.reset();
65 60
66 ViewsContentClientMainPartsAura::PostMainMessageLoopRun(); 61 ViewsContentClientMainPartsAura::PostMainMessageLoopRun();
67 } 62 }
68 63
69 } // namespace 64 } // namespace
70 65
71 // static 66 // static
72 ViewsContentClientMainParts* ViewsContentClientMainParts::Create( 67 ViewsContentClientMainParts* ViewsContentClientMainParts::Create(
73 const content::MainFunctionParams& content_params, 68 const content::MainFunctionParams& content_params,
74 ViewsContentClient* views_content_client) { 69 ViewsContentClient* views_content_client) {
75 return new ViewsContentClientMainPartsChromeOS( 70 return new ViewsContentClientMainPartsChromeOS(
76 content_params, views_content_client); 71 content_params, views_content_client);
77 } 72 }
78 73
79 } // namespace ui 74 } // namespace ui
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11_unittest.cc ('k') | ui/wm/test/wm_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698