Adding URLResponse Disk Cache to mojo.
This CL introduces a url response disk cache that allows the shell and content
handlers to access cached response data as file without the need to
stream the full content nor create a new file. It also allows
content handlers to access uncompressed cached archive.
The cache service is loaded internally by the shell because it is used
during application loads.
The android handler is using this service to cache the uncompressed archive of
android applications and the compiled dex files
R=blundell@chromium.org, davemoore@chromium.org
Review URL: https://codereview.chromium.org/1088533003
diff --git a/shell/background_application_loader_unittest.cc b/shell/background_application_loader_unittest.cc
new file mode 100644
index 0000000..ef47060
--- /dev/null
+++ b/shell/background_application_loader_unittest.cc
@@ -0,0 +1,50 @@
+// 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/background_application_loader.h"
+
+#include "mojo/public/interfaces/application/application.mojom.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace shell {
+namespace {
+
+class DummyLoader : public ApplicationLoader {
+ public:
+ DummyLoader() : simulate_app_quit_(true) {}
+ ~DummyLoader() override {}
+
+ // ApplicationLoader overrides:
+ void Load(
+ const GURL& url,
+ mojo::InterfaceRequest<mojo::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);
+ mojo::ApplicationPtr application;
+ loader.Load(GURL(), mojo::GetProxy(&application));
+}
+
+} // namespace
+} // namespace shell