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

Unified Diff: mojo/shell/android/background_application_loader_unittest.cc

Issue 1049993002: Get mojo_shell building inside chromium checkout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix presubmit Created 5 years, 9 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 | « mojo/shell/android/background_application_loader.cc ('k') | mojo/shell/android/bootstrap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/android/background_application_loader_unittest.cc
diff --git a/mojo/shell/android/background_application_loader_unittest.cc b/mojo/shell/android/background_application_loader_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4d180738fea04e0c910d9f1882a7e0286f950ecb
--- /dev/null
+++ b/mojo/shell/android/background_application_loader_unittest.cc
@@ -0,0 +1,51 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/shell/android/background_application_loader.h"
+
+#include "mojo/public/interfaces/application/application.mojom.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace shell {
+namespace {
+
+class DummyLoader : public ApplicationLoader {
+ public:
+ DummyLoader() : simulate_app_quit_(true) {}
+ ~DummyLoader() override {}
+
+ // ApplicationLoader overrides:
+ void Load(const GURL& url,
+ InterfaceRequest<Application> application_request) override {
+ if (simulate_app_quit_)
+ base::MessageLoop::current()->Quit();
+ }
+
+ void DontSimulateAppQuit() { simulate_app_quit_ = false; }
+
+ private:
+ bool simulate_app_quit_;
+};
+
+// Tests that the loader can start and stop gracefully.
+TEST(BackgroundApplicationLoaderTest, StartStop) {
+ scoped_ptr<ApplicationLoader> real_loader(new DummyLoader());
+ BackgroundApplicationLoader loader(real_loader.Pass(), "test",
+ base::MessageLoop::TYPE_DEFAULT);
+}
+
+// Tests that the loader can load a service that is well behaved (quits
+// itself).
+TEST(BackgroundApplicationLoaderTest, Load) {
+ scoped_ptr<ApplicationLoader> real_loader(new DummyLoader());
+ BackgroundApplicationLoader loader(real_loader.Pass(), "test",
+ base::MessageLoop::TYPE_DEFAULT);
+ ApplicationPtr application;
+ loader.Load(GURL(), GetProxy(&application));
+}
+
+} // namespace
+} // namespace shell
+} // namespace mojo
« no previous file with comments | « mojo/shell/android/background_application_loader.cc ('k') | mojo/shell/android/bootstrap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698