Moves BackgroundShellApplicationLoader to shell/android

As this is the only place that uses it. Also renamed to
BackgroundApplicationLoader.

BUG=none
TEST=none
R=qsr@chromium.org

Review URL: https://codereview.chromium.org/788243007
diff --git a/shell/android/background_application_loader_unittest.cc b/shell/android/background_application_loader_unittest.cc
new file mode 100644
index 0000000..09bc2c8
--- /dev/null
+++ b/shell/android/background_application_loader_unittest.cc
@@ -0,0 +1,56 @@
+// 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 "shell/android/background_application_loader.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+
+namespace {
+
+class DummyLoader : public ApplicationLoader {
+ public:
+  DummyLoader() : simulate_app_quit_(true) {}
+  ~DummyLoader() override {}
+
+  // ApplicationLoader overrides:
+  void Load(ApplicationManager* manager,
+            const GURL& url,
+            ScopedMessagePipeHandle shell_handle,
+            LoadCallback callback) override {
+    if (simulate_app_quit_)
+      base::MessageLoop::current()->Quit();
+  }
+
+  void OnApplicationError(ApplicationManager* manager,
+                          const GURL& url) override {}
+
+  void DontSimulateAppQuit() { simulate_app_quit_ = false; }
+
+ private:
+  bool simulate_app_quit_;
+};
+
+}  // namespace
+
+// 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);
+  MessagePipe dummy;
+  loader.Load(NULL, GURL(), dummy.handle0.Pass(),
+              ApplicationLoader::SimpleLoadCallback());
+}
+
+}  // namespace mojo