diff options
author | dbeam@chromium.org <dbeam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-24 03:27:02 +0000 |
---|---|---|
committer | dbeam@chromium.org <dbeam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-24 03:27:02 +0000 |
commit | 028b8ac199c3b9ef7532ae26386246ef53e61a71 (patch) | |
tree | 34abe83dddee781ae513787c87061309a6b98491 /ash/test/test_metro_viewer_process_host.h | |
parent | 33826fbd796d286022b16e7de324211a1bfbbb53 (diff) | |
download | chromium_src-028b8ac199c3b9ef7532ae26386246ef53e61a71.zip chromium_src-028b8ac199c3b9ef7532ae26386246ef53e61a71.tar.gz chromium_src-028b8ac199c3b9ef7532ae26386246ef53e61a71.tar.bz2 |
Revert 201806 "Create MetroViewerProcessHost as a common base fo..."
Broke ash_unittests on Win8 Aura:
http://build.chromium.org/p/chromium.win/builders/Win8%20Aura/builds/6316
[ RUN ] AcceleratorControllerTest.Register
[912:1324:0523/094526:1371217:INFO:test_metro_viewer_process_host.cc(42)] ash::test::TestMetroViewerProcessHost::OnSetTargetSurface, target_surface = 131580
[912:1324:0523/094526:1371233:FATAL:ash_test_base.cc(149)] Check failed: !metro_viewer_host_->closed_unexpectedly().
Backtrace:
base::debug::StackTrace::StackTrace [0x100839F1+33]
logging::LogMessage::~LogMessage [0x100F6FCE+94]
ash::test::AshTestBase::TearDown [0x006DC397+471]
testing::internal::HandleExceptionsInMethodIfSupported<testing::Test,void> [0x007405FF+319]
testing::Test::Run [0x0072A525+229]
testing::TestInfo::Run [0x0072AF4D+221]
testing::TestCase::Run [0x0072B71F+239]
testing::internal::UnitTestImpl::RunAllTests [0x0073234D+701]
testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl,bool> [0x00741227+327]
testing::UnitTest::Run [0x00730BB0+192]
base::TestSuite::Run [0x00756AE0+240]
main [0x0058AFA4+100]
__tmainCRTStartup [0x0075BA6F+447] (f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c:555)
mainCRTStartup [0x0075B89F+15] (f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c:371)
BaseThreadInitThunk [0x76D78543+14]
RtlInitializeExceptionChain [0x7775AC69+133]
RtlInitializeExceptionChain [0x7775AC3C+88]
(No symbol) [0x00000000]
[912:1324:0523/094526:1371233:FATAL:ash_test_base.cc(149)] Check failed: !metro_viewer_host_->closed_unexpectedly().
Backtrace:
base::debug::StackTrace::StackTrace [0x100839F1+33]
logging::LogMessage::~LogMessage [0x100F6FCE+94]
ash::test::AshTestBase::TearDown [0x006DC397+471]
testing::internal::HandleExceptionsInMethodIfSupported<testing::Test,void> [0x007405FF+319]
testing::Test::Run [0x0072A525+229]
testing::TestInfo::Run [0x0072AF4D+221]
testing::TestCase::Run [0x0072B71F+239]
testing::internal::UnitTestImpl::RunAllTests [0x0073234D+701]
testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl,bool> [0x00741227+327]
testing::UnitTest::Run [0x00730BB0+192]
base::TestSuite::Run [0x00756AE0+240]
main [0x0058AFA4+100]
__tmainCRTStartup [0x0075BA6F+447] (f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c:555)
mainCRTStartup [0x0075B89F+15] (f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c:371)
BaseThreadInitThunk [0x76D78543+14]
RtlInitializeExceptionChain [0x7775AC69+133]
RtlInitializeExceptionChain [0x7775AC3C+88]
(No symbol) [0x00000000]
> Create MetroViewerProcessHost as a common base for TestMetroViewerProcessHost and ChromeMetroViewerProcessHost
>
> Bringing LaunchViewerAndWaitForConnection() to the common base so that ChromeMetroViewerProcessHost can also benefit from it (required for ash browser tests).
>
> BUG=179830
>
> Review URL: https://chromiumcodereview.appspot.com/14629025
TBR=gab@chromium.org
Review URL: https://codereview.chromium.org/15966003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201966 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/test/test_metro_viewer_process_host.h')
-rw-r--r-- | ash/test/test_metro_viewer_process_host.h | 58 |
1 files changed, 51 insertions, 7 deletions
diff --git a/ash/test/test_metro_viewer_process_host.h b/ash/test/test_metro_viewer_process_host.h index 0f24169..f52230b 100644 --- a/ash/test/test_metro_viewer_process_host.h +++ b/ash/test/test_metro_viewer_process_host.h @@ -7,25 +7,69 @@ #include <string> -#include "win8/viewer/metro_viewer_process_host.h" +#include "base/memory/scoped_ptr.h" +#include "base/synchronization/waitable_event.h" +#include "base/threading/non_thread_safe.h" +#include "base/threading/thread.h" +#include "ipc/ipc_channel_proxy.h" +#include "ipc/ipc_listener.h" +#include "ipc/ipc_sender.h" +#include "ui/gfx/native_widget_types.h" class AcceleratedSurface; namespace ash { namespace test { -class TestMetroViewerProcessHost : public win8::MetroViewerProcessHost { +class TestMetroViewerProcessHost : public IPC::Listener, + public IPC::Sender, + public base::NonThreadSafe { public: - TestMetroViewerProcessHost(const std::string& ipc_channel_name, - base::SingleThreadTaskRunner* ipc_task_runner); + explicit TestMetroViewerProcessHost(const std::string& ipc_channel_name); virtual ~TestMetroViewerProcessHost(); + // Launches the viewer process associated with the given |app_user_model_id| + // and blocks until that viewer process connects or until a timeout is + // reached. Returns true if the viewer process connects before the timeout is + // reached. + bool LaunchViewerAndWaitForConnection( + const base::string16& app_user_model_id); + + // IPC::Sender implementation: + virtual bool Send(IPC::Message* msg) OVERRIDE; + + // IPC::Listener implementation: + virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual void OnChannelError() OVERRIDE; + bool closed_unexpectedly() { return closed_unexpectedly_; } private: - // win8::MetroViewerProcessHost implementation - virtual void OnChannelError() OVERRIDE; - virtual void OnSetTargetSurface(gfx::NativeViewId target_surface) OVERRIDE; + void OnSetTargetSurface(gfx::NativeViewId target_surface); + + void NotifyChannelConnected(); + + // Inner message filter used to handle connection event on the IPC channel + // proxy's background thread. This prevents consumers of + // TestMetroViewerProcessHost from having to pump messages on their own + // message loop. + class InternalMessageFilter : public IPC::ChannelProxy::MessageFilter { + public: + InternalMessageFilter(TestMetroViewerProcessHost* owner); + + // IPC::ChannelProxy::MessageFilter implementation. + virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; + + private: + TestMetroViewerProcessHost* owner_; + DISALLOW_COPY_AND_ASSIGN(InternalMessageFilter); + }; + + // Members related to the IPC channel. Note that the order is important + // here as ipc_thread_ should be destroyed after channel_. + base::Thread ipc_thread_; + scoped_ptr<IPC::ChannelProxy> channel_; + base::WaitableEvent channel_connected_event_; scoped_ptr<AcceleratedSurface> backing_surface; |