Roll src/third_party/skia 0f881c6:b436ed6
[chromium-blink-merge.git] / ash / test / test_metro_viewer_process_host.cc
blob156cf99770c84fe96e732ff9bba86068f489614b
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ash/test/test_metro_viewer_process_host.h"
7 #include <windef.h>
9 #include "base/logging.h"
10 #include "ui/aura/remote_window_tree_host_win.h"
11 #include "ui/gfx/win/dpi.h"
13 namespace ash {
14 namespace test {
16 TestMetroViewerProcessHost::TestMetroViewerProcessHost(
17 base::SingleThreadTaskRunner* ipc_task_runner)
18 : MetroViewerProcessHost(ipc_task_runner),
19 closed_unexpectedly_(false) {
22 TestMetroViewerProcessHost::~TestMetroViewerProcessHost() {
25 void TestMetroViewerProcessHost::TerminateViewer() {
26 base::ProcessId viewer_process_id = GetViewerProcessId();
27 if (viewer_process_id != base::kNullProcessId) {
28 base::ProcessHandle viewer_process = NULL;
29 base::OpenProcessHandleWithAccess(
30 viewer_process_id,
31 PROCESS_QUERY_INFORMATION | SYNCHRONIZE | PROCESS_TERMINATE,
32 &viewer_process);
33 if (viewer_process) {
34 ::TerminateProcess(viewer_process, 0);
35 ::WaitForSingleObject(viewer_process, INFINITE);
36 ::CloseHandle(viewer_process);
41 void TestMetroViewerProcessHost::OnChannelError() {
42 closed_unexpectedly_ = true;
43 aura::RemoteWindowTreeHostWin::Instance()->Disconnected();
46 void TestMetroViewerProcessHost::OnSetTargetSurface(
47 gfx::NativeViewId target_surface,
48 float device_scale) {
49 DLOG(INFO) << __FUNCTION__ << ", target_surface = " << target_surface;
50 HWND hwnd = reinterpret_cast<HWND>(target_surface);
51 gfx::InitDeviceScaleFactor(device_scale);
52 aura::RemoteWindowTreeHostWin::Instance()->SetRemoteWindowHandle(hwnd);
53 aura::RemoteWindowTreeHostWin::Instance()->Connected(this);
56 void TestMetroViewerProcessHost::OnOpenURL(const base::string16& url) {
59 void TestMetroViewerProcessHost::OnHandleSearchRequest(
60 const base::string16& search_string) {
63 void TestMetroViewerProcessHost::OnWindowSizeChanged(uint32 width,
64 uint32 height) {
67 } // namespace test
68 } // namespace ash