Commit a53663e9 authored by Maciej Pawlowski's avatar Maciej Pawlowski Committed by Commit Bot

Don't re-initialize mojo::core in gaia unittests

mojo::core::Init() should be called once per process, not once per test.
run_all_unittests.cc happens to already define a test launcher that
calls mojo::core::Init(), so if we use that instead of the base
launcher, we can get rid of re-initialization in test fixtures.

Bug: 869281
Change-Id: Ieb96cbe580f5f1750d7f61693c288bb578cb63b0
Reviewed-on: https://chromium-review.googlesource.com/1155595
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Reviewed-by: default avatarRoger Tawa <rogerta@chromium.org>
Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584501}
parent 322af3e4
......@@ -229,6 +229,18 @@ static_library("test_support") {
}
}
source_set("run_all_unittests") {
testonly = true
sources = [
"run_all_unittests.cc",
]
deps = [
"//base/test:test_support",
"//mojo/core/embedder",
]
}
test("google_apis_unittests") {
sources = [
"gaia/gaia_auth_fetcher_unittest.cc",
......@@ -245,7 +257,6 @@ test("google_apis_unittests") {
"gaia/ubertoken_fetcher_unittest.cc",
"google_api_keys_unittest.cc",
"google_api_keys_unittest.h",
"test/run_all_unittests.cc",
]
data = [
......@@ -256,10 +267,10 @@ test("google_apis_unittests") {
deps = [
":google_apis",
":run_all_unittests",
":test_support",
"//base",
"//base/test:test_support",
"//mojo/core/embedder",
"//testing/gmock",
"//testing/gtest",
]
......
include_rules = [
"-chrome",
"-content",
"+base/test",
"+crypto",
"+mojo/core/embedder",
"+mojo/edk",
"+net",
"+services/network/public",
......
......@@ -12,6 +12,5 @@ specific_include_rules = {
r"|ubertoken_fetcher_unittest\.cc"
r")": [
"+services/network/test",
"+mojo/core/embedder",
],
}
\ No newline at end of file
}
......@@ -157,7 +157,6 @@ test("gcm_unit_tests") {
"engine/mcs_client_unittest.cc",
"engine/registration_request_unittest.cc",
"engine/unregistration_request_unittest.cc",
"test/run_all_unittests.cc",
]
deps = [
......@@ -165,7 +164,7 @@ test("gcm_unit_tests") {
":test_support",
"//base",
"//base/test:test_support",
"//mojo/core/embedder",
"//google_apis:run_all_unittests",
"//mojo/public/cpp/system:system",
"//net",
"//net:test_support",
......
include_rules = [
"+mojo/core/embedder",
]
......@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/message_loop/message_loop.h"
#include "base/test/launcher/unit_test_launcher.h"
#include "base/test/test_suite.h"
#include "mojo/core/embedder/embedder.h"
......
include_rules = [
"+mojo/core/embedder",
]
// 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/message_loop/message_loop.h"
#include "base/test/launcher/unit_test_launcher.h"
#include "base/test/test_suite.h"
#include "mojo/core/embedder/embedder.h"
int main(int argc, char** argv) {
base::TestSuite test_suite(argc, argv);
mojo::core::Init();
return base::LaunchUnitTests(
argc, argv,
base::BindOnce(&base::TestSuite::Run, base::Unretained(&test_suite)));
}
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