Commit 64acd724 authored by Fabrice de Gans-Riberi's avatar Fabrice de Gans-Riberi Committed by Commit Bot

Switch http_service_tests to use TestLauncher.

Previously, the http_service_tests suite was not using the TestLauncher
facilities, which caused it to fail on the waterfall.

Bug: 896884
Change-Id: I9ce03cf45f0bd75944dce62bed5e16e2df6a4191
Tested: Locally
Reviewed-on: https://chromium-review.googlesource.com/c/1292591
Commit-Queue: Fabrice de Gans-Riberi <fdegans@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601368}
parent 306ca843
...@@ -47,11 +47,11 @@ fuchsia_package_runner("http_pkg_runner") { ...@@ -47,11 +47,11 @@ fuchsia_package_runner("http_pkg_runner") {
test("http_service_tests") { test("http_service_tests") {
sources = [ sources = [
"http_service_test_main.cc",
"http_service_unittest.cc", "http_service_unittest.cc",
] ]
deps = [ deps = [
":http_lib", ":http_lib",
"//base/test:run_all_unittests",
"//net:test_support", "//net:test_support",
"//testing/gtest", "//testing/gtest",
] ]
......
// Copyright 2018 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 "base/at_exit.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
#include "base/task/task_scheduler/task_scheduler.h"
#include "testing/gtest/include/gtest/gtest.h"
int main(int argc, char** argv) {
// Instantiate various global structures.
base::TaskScheduler::CreateAndStartWithDefaultParams("HTTP Service Test");
base::CommandLine::Init(argc, argv);
base::MessageLoopForIO loop;
base::AtExitManager exit_manager;
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/fuchsia/scoped_service_binding.h" #include "base/fuchsia/scoped_service_binding.h"
#include "base/fuchsia/service_directory.h" #include "base/fuchsia/service_directory.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/test/scoped_task_environment.h"
#include "net/base/net_errors.h" #include "net/base/net_errors.h"
#include "net/test/embedded_test_server/default_handlers.h" #include "net/test/embedded_test_server/default_handlers.h"
#include "net/test/embedded_test_server/embedded_test_server.h" #include "net/test/embedded_test_server/embedded_test_server.h"
...@@ -32,7 +33,10 @@ using ResponseHeaders = std::multimap<std::string, std::string>; ...@@ -32,7 +33,10 @@ using ResponseHeaders = std::multimap<std::string, std::string>;
class HttpServiceTest : public ::testing::Test { class HttpServiceTest : public ::testing::Test {
public: public:
HttpServiceTest() : binding_(&http_service_server_) { HttpServiceTest()
: task_environment_(
base::test::ScopedTaskEnvironment::MainThreadType::IO),
binding_(&http_service_server_) {
// Initialize the test server. // Initialize the test server.
test_server_.AddDefaultHandlers( test_server_.AddDefaultHandlers(
base::FilePath(FILE_PATH_LITERAL(kTestFilePath))); base::FilePath(FILE_PATH_LITERAL(kTestFilePath)));
...@@ -40,6 +44,8 @@ class HttpServiceTest : public ::testing::Test { ...@@ -40,6 +44,8 @@ class HttpServiceTest : public ::testing::Test {
} }
protected: protected:
base::test::ScopedTaskEnvironment task_environment_;
void SetUp() override { void SetUp() override {
ASSERT_TRUE(test_server_.Start()); ASSERT_TRUE(test_server_.Start());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment