Chromium Code Reviews| 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 |