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

Unified Diff: ash/test/test_metro_viewer_process_host.cc

Issue 14629025: Create MetroViewerProcessHost as a common base for TestMetroViewerProcessHost and ChromeMetroViewer… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge before dcommit Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/test/test_metro_viewer_process_host.h ('k') | chrome/browser/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/test/test_metro_viewer_process_host.cc
diff --git a/ash/test/test_metro_viewer_process_host.cc b/ash/test/test_metro_viewer_process_host.cc
index 277864f1681bffa394c50427827d36d3557d779f..a5d36e95a2de2a2ce505c6ebeed8858cc34a1816 100644
--- a/ash/test/test_metro_viewer_process_host.cc
+++ b/ash/test/test_metro_viewer_process_host.cc
@@ -23,81 +23,14 @@
namespace ash {
namespace test {
-TestMetroViewerProcessHost::InternalMessageFilter::InternalMessageFilter(
- TestMetroViewerProcessHost* owner)
- : owner_(owner) {
-}
-
-void TestMetroViewerProcessHost::InternalMessageFilter::OnChannelConnected(
- int32 peer_pid) {
- owner_->NotifyChannelConnected();
-}
-
TestMetroViewerProcessHost::TestMetroViewerProcessHost(
- const std::string& ipc_channel_name)
- : ipc_thread_("test_metro_viewer_ipc_thread"),
- channel_connected_event_(false, false),
+ const std::string& ipc_channel_name,
+ base::SingleThreadTaskRunner* ipc_task_runner)
+ : MetroViewerProcessHost(ipc_channel_name, ipc_task_runner),
closed_unexpectedly_(false) {
-
- base::Thread::Options options;
- options.message_loop_type = base::MessageLoop::TYPE_IO;
- ipc_thread_.StartWithOptions(options);
-
- channel_.reset(new IPC::ChannelProxy(
- ipc_channel_name.c_str(),
- IPC::Channel::MODE_NAMED_SERVER,
- this,
- ipc_thread_.message_loop_proxy()));
-
- channel_->AddFilter(new InternalMessageFilter(this));
}
TestMetroViewerProcessHost::~TestMetroViewerProcessHost() {
- channel_.reset();
- ipc_thread_.Stop();
-}
-
-void TestMetroViewerProcessHost::NotifyChannelConnected() {
- channel_connected_event_.Signal();
-}
-
-bool TestMetroViewerProcessHost::LaunchViewerAndWaitForConnection(
- const base::string16& app_user_model_id) {
- // Activate the viewer process. NOTE: This assumes that the viewer process is
- // registered as the default browser using the provided |app_user_model_id|.
-
- // TODO(robertshield): Initialize COM at test suite startup.
- base::win::ScopedCOMInitializer com_initializer;
-
- base::win::ScopedComPtr<IApplicationActivationManager> activator;
- HRESULT hr = activator.CreateInstance(CLSID_ApplicationActivationManager);
- if (SUCCEEDED(hr)) {
- DWORD pid = 0;
- hr = activator->ActivateApplication(
- app_user_model_id.c_str(), L"open", AO_NONE, &pid);
- }
-
- LOG_IF(ERROR, FAILED(hr)) << "Tried and failed to launch Metro Chrome. "
- << "hr=" << std::hex << hr;
-
- // Having launched the viewer process, now we wait for it to connect.
- return channel_connected_event_.TimedWait(base::TimeDelta::FromSeconds(60));
-}
-
-bool TestMetroViewerProcessHost::Send(IPC::Message* msg) {
- return channel_->Send(msg);
-}
-
-bool TestMetroViewerProcessHost::OnMessageReceived(
- const IPC::Message& message) {
- DCHECK(CalledOnValidThread());
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(TestMetroViewerProcessHost, message)
- IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SetTargetSurface, OnSetTargetSurface)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- return handled ? true :
- aura::RemoteRootWindowHostWin::Instance()->OnMessageReceived(message);
}
void TestMetroViewerProcessHost::OnChannelError() {
« no previous file with comments | « ash/test/test_metro_viewer_process_host.h ('k') | chrome/browser/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698