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

Unified Diff: blimp/engine/testing/app/content_testing_main.cc

Issue 2572563006: [Blimp] Refactor Blimp test engine with embedded test server and URL rewriting (Closed)
Patch Set: Created 4 years 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
Index: blimp/engine/testing/app/content_testing_main.cc
diff --git a/blimp/engine/testing/app/content_testing_main.cc b/blimp/engine/testing/app/content_testing_main.cc
new file mode 100644
index 0000000000000000000000000000000000000000..29a765e474fdaf4f178bd644c9a91a39fdc5c9db
--- /dev/null
+++ b/blimp/engine/testing/app/content_testing_main.cc
@@ -0,0 +1,55 @@
+// Copyright (c) 2016 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 "blimp/engine/testing/app/content_testing_main.h"
+
+#include <iostream>
+#include <memory>
+
+#include "base/logging.h"
+#include "blimp/engine/testing/app/blimp_url_rewriter.h"
+#include "blimp/engine/testing/session/blimp_engine_testing_session.h"
+#include "content/browser/browser_url_handler_impl.h"
+#include "content/public/app/content_main_runner.h"
+#include "content/public/browser/browser_url_handler.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
+
+namespace blimp {
+namespace engine {
+
+namespace test {
+
+const base::FilePath::CharType kBlimpTestRoot[] = FILE_PATH_LITERAL("");
+
+int ContentTestingMain(const content::ContentMainParams& params) {
+ std::unique_ptr<content::ContentMainRunner> main_runner(
+ content::ContentMainRunner::Create());
+
+ int exit_code = main_runner->Initialize(params);
+
+ blimp::engine::test::g_ets_instance.reset(new net::EmbeddedTestServer());
+ blimp::engine::test::g_ets_instance->ServeFilesFromSourceDirectory(
+ base::FilePath(kBlimpTestRoot));
+ DCHECK(blimp::engine::test::g_ets_instance->Start());
shenghuazhang 2016/12/13 02:14:19 main_runner->Run() complains that Zygote should be
jbudorick 2016/12/13 18:31:03 We would definitely need to start the ETS instance
+
+ content::BrowserURLHandler::GetInstance()->AddHandlerPair(
+ &blimp::engine::test::HandleBlimpTestURL,
+ content::BrowserURLHandler::null_handler());
+
+ if (exit_code >= 0)
+ return exit_code;
+
+ exit_code = main_runner->Run();
+
+ main_runner->Shutdown();
+
+ DCHECK(blimp::engine::test::g_ets_instance->ShutdownAndWaitUntilComplete());
+
+ return exit_code;
+}
+
+} // namespace test
+
+} // namespace engine
+} // namespace blimp

Powered by Google App Engine
This is Rietveld 408576698