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

Side by Side Diff: ui/views/mus/views_aura_mus_test_suite.cc

Issue 2562633004: Wires up SimulateNativeDestroy for views-aura-mus (Closed)
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/views/mus/views_aura_mus_test_suite.h" 5 #include "ui/views/mus/views_aura_mus_test_suite.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "base/synchronization/waitable_event.h" 13 #include "base/synchronization/waitable_event.h"
14 #include "base/threading/simple_thread.h" 14 #include "base/threading/simple_thread.h"
15 #include "base/threading/thread.h" 15 #include "base/threading/thread.h"
16 #include "services/service_manager/background/background_service_manager.h" 16 #include "services/service_manager/background/background_service_manager.h"
17 #include "services/service_manager/public/cpp/connector.h" 17 #include "services/service_manager/public/cpp/connector.h"
18 #include "services/service_manager/public/cpp/service.h" 18 #include "services/service_manager/public/cpp/service.h"
19 #include "services/service_manager/public/cpp/service_context.h" 19 #include "services/service_manager/public/cpp/service_context.h"
20 #include "services/ui/common/switches.h" 20 #include "services/ui/common/switches.h"
21 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
22 #include "ui/aura/mus/window_tree_host_mus.h"
22 #include "ui/aura/test/env_test_helper.h" 23 #include "ui/aura/test/env_test_helper.h"
24 #include "ui/aura/window.h"
23 #include "ui/views/mus/desktop_window_tree_host_mus.h" 25 #include "ui/views/mus/desktop_window_tree_host_mus.h"
24 #include "ui/views/mus/mus_client.h" 26 #include "ui/views/mus/mus_client.h"
25 #include "ui/views/mus/test_utils.h" 27 #include "ui/views/mus/test_utils.h"
26 #include "ui/views/test/platform_test_helper.h" 28 #include "ui/views/test/platform_test_helper.h"
27 #include "ui/views/test/views_test_helper_aura.h" 29 #include "ui/views/test/views_test_helper_aura.h"
28 #include "ui/views/views_delegate.h" 30 #include "ui/views/views_delegate.h"
29 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" 31 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
30 32
31 namespace views { 33 namespace views {
32 namespace { 34 namespace {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 ~PlatformTestHelperMus() override { 66 ~PlatformTestHelperMus() override {
65 aura::test::EnvTestHelper().SetWindowTreeClient(nullptr); 67 aura::test::EnvTestHelper().SetWindowTreeClient(nullptr);
66 } 68 }
67 69
68 // PlatformTestHelper: 70 // PlatformTestHelper:
69 void OnTestHelperCreated(ViewsTestHelper* helper) override { 71 void OnTestHelperCreated(ViewsTestHelper* helper) override {
70 static_cast<ViewsTestHelperAura*>(helper)->EnableMusWithWindowTreeClient( 72 static_cast<ViewsTestHelperAura*>(helper)->EnableMusWithWindowTreeClient(
71 mus_client_->window_tree_client()); 73 mus_client_->window_tree_client());
72 } 74 }
73 void SimulateNativeDestroy(Widget* widget) override { 75 void SimulateNativeDestroy(Widget* widget) override {
74 // TODO: this should call through to a WindowTreeClientDelegate 76 aura::WindowTreeHostMus* window_tree_host =
75 // function that destroys the WindowTreeHost. http://crbug.com/663868. 77 static_cast<aura::WindowTreeHostMus*>(
76 widget->CloseNow(); 78 widget->GetNativeView()->GetHost());
79 static_cast<aura::WindowTreeClientDelegate*>(mus_client_.get())
msw 2016/12/08 20:16:38 Unfortunate that we need to cast; hopefully that's
80 ->OnEmbedRootDestroyed(window_tree_host);
77 } 81 }
78 82
79 private: 83 private:
80 std::unique_ptr<MusClient> mus_client_; 84 std::unique_ptr<MusClient> mus_client_;
81 85
82 DISALLOW_COPY_AND_ASSIGN(PlatformTestHelperMus); 86 DISALLOW_COPY_AND_ASSIGN(PlatformTestHelperMus);
83 }; 87 };
84 88
85 std::unique_ptr<PlatformTestHelper> CreatePlatformTestHelper( 89 std::unique_ptr<PlatformTestHelper> CreatePlatformTestHelper(
86 const service_manager::Identity& identity, 90 const service_manager::Identity& identity,
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 ViewsTestSuite::Initialize(); 202 ViewsTestSuite::Initialize();
199 service_manager_connections_ = base::MakeUnique<ServiceManagerConnection>(); 203 service_manager_connections_ = base::MakeUnique<ServiceManagerConnection>();
200 } 204 }
201 205
202 void ViewsAuraMusTestSuite::Shutdown() { 206 void ViewsAuraMusTestSuite::Shutdown() {
203 service_manager_connections_.reset(); 207 service_manager_connections_.reset();
204 ViewsTestSuite::Shutdown(); 208 ViewsTestSuite::Shutdown();
205 } 209 }
206 210
207 } // namespace views 211 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698