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

Unified Diff: media/mojo/services/renderer_unittest.cc

Issue 709923003: Use ApplicationTestBase for MojoRendererTest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 | « media/mojo/services/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mojo/services/renderer_unittest.cc
diff --git a/media/mojo/services/renderer_unittest.cc b/media/mojo/services/renderer_unittest.cc
index a191d726adf6791eaed5f811188d25cfd3133846..a62f461eed31aaa942124568e7beee62539de839 100644
--- a/media/mojo/services/renderer_unittest.cc
+++ b/media/mojo/services/renderer_unittest.cc
@@ -16,7 +16,7 @@
#include "mojo/public/c/system/main.h"
#include "mojo/public/cpp/application/application_delegate.h"
#include "mojo/public/cpp/application/application_impl.h"
-#include "testing/gtest/include/gtest/gtest.h"
+#include "mojo/public/cpp/application/application_test_base.h"
namespace {
@@ -40,9 +40,6 @@ class MojoRendererTestHelper : public mojo::ApplicationDelegate {
DISALLOW_COPY_AND_ASSIGN(MojoRendererTestHelper);
};
-// TODO(tim): Reconcile this with mojo apptest framework when ready.
-MojoRendererTestHelper* g_test_delegate = NULL;
-
// TODO(tim): Make media::FakeDemuxerStream support audio and use that for the
// DemuxerStream implementation instead.
class FakeDemuxerStream : public media::DemuxerStreamProvider,
@@ -104,14 +101,23 @@ class FakeDemuxerStream : public media::DemuxerStreamProvider,
namespace media {
-class MojoRendererTest : public testing::Test {
+class MojoRendererTest : public mojo::test::ApplicationTestBase {
public:
- MojoRendererTest() : service_provider_(NULL) {}
+ MojoRendererTest()
+ : ApplicationTestBase(mojo::Array<mojo::String>()),
+ service_provider_(NULL) {}
+ ~MojoRendererTest() override {}
+
+ // ApplicationTestBase implementation.
+ mojo::ApplicationDelegate* GetApplicationDelegate() override {
+ return &mojo_renderer_test_helper_;
+ }
void SetUp() override {
demuxer_stream_provider_.reset(new FakeDemuxerStream());
+ ApplicationTestBase::SetUp();
DaleCurtis 2014/11/10 21:03:30 Why not first?
service_provider_ =
- g_test_delegate->application_impl()
+ application_impl()
->ConnectToApplication("mojo:media_mojo_renderer_app")
->GetServiceProvider();
}
@@ -125,6 +131,7 @@ class MojoRendererTest : public testing::Test {
}
private:
+ MojoRendererTestHelper mojo_renderer_test_helper_;
scoped_ptr<DemuxerStreamProvider> demuxer_stream_provider_;
mojo::ServiceProvider* service_provider_;
@@ -156,29 +163,3 @@ TEST_F(MojoRendererTest, BasicInitialize) {
}
} // namespace media
-
-MojoResult MojoMain(MojoHandle shell_handle) {
- base::CommandLine::Init(0, NULL);
-#if !defined(COMPONENT_BUILD)
- base::AtExitManager at_exit;
-#endif
-
- // TODO(tim): Reconcile this with apptest framework when it is ready.
- scoped_ptr<mojo::ApplicationDelegate> delegate(new MojoRendererTestHelper());
- g_test_delegate = static_cast<MojoRendererTestHelper*>(delegate.get());
- {
- base::MessageLoop loop;
- mojo::ApplicationImpl impl(
- delegate.get(),
- mojo::MakeScopedHandle(mojo::MessagePipeHandle(shell_handle)));
-
- int argc = 0;
- char** argv = NULL;
- testing::InitGoogleTest(&argc, argv);
- mojo_ignore_result(RUN_ALL_TESTS());
- }
-
- g_test_delegate = NULL;
- delegate.reset();
- return MOJO_RESULT_OK;
-}
« no previous file with comments | « media/mojo/services/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698