Skip to content

Commit

Permalink
Roll googletest to 1.8.0.
Browse files Browse the repository at this point in the history
This is a re-land of http://crrev.com/2779193002 which was reverted due to
build errors on Mac.

GoogleTest (gtest) and GoogleMock (gmock) are now hosted into the same
googletest repository. In order to cope with this, the googletest
repository is now sourced at third_party/googletest.

The file/directory layout of Google Test is not yet considered stable.
To minimize disruption while Google Test stabilizes, Chromium code will
be insulated from third_party/googletest.

* testing/gtest/include/gtest/ and testing/gmock/include/gmock have
  been populated with headers that forward into the appropriate locations of
  third_party/googletest

* testing/BUILD.gn has been populated with the targets
  //testing/gtest(:gtest_main) and //testing/gmock(:gmock_main), which
  depend on the appropriate //third_party/googletest targets.

All Chromium code should keep depending on the targets and headers
in testing/{gtest,gmock} for now.

BUG=630705
TESTED=ninja -C out/Default/ ced_unittests && ninja -C out/Default
TBR=rkc,dpranke,agl

Review-Url: https://codereview.chromium.org/2852613002
Cr-Commit-Position: refs/heads/master@{#468860}
  • Loading branch information
pwnall authored and Commit bot committed May 3, 2017
1 parent 5656628 commit dbcef9b
Show file tree
Hide file tree
Showing 30 changed files with 428 additions and 23 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,6 @@ vs-chromium-project.txt
/sql/sql_unittests_run.xml
/sync/sync.xml
/sync_testserver.log
/testing/gmock
/testing/gtest
/testserver.log
/tools/luci-go/linux64/isolate
/tools/luci-go/mac64/isolate
Expand Down
9 changes: 3 additions & 6 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,6 @@ deps = {
'src/sdch/open-vcdiff':
Var('chromium_git') + '/external/github.com/google/open-vcdiff.git' + '@' + '2b9bd1fe548520e9355e457a134bab7e2f9c56c0',

'src/testing/gtest':
Var('chromium_git') + '/external/github.com/google/googletest.git' + '@' + '6f8a66431cb592dad629028a50b3dd418a408c87',

'src/testing/gmock':
Var('chromium_git') + '/external/googlemock.git' + '@' + '0421b6f358139f02e102c9c332ce19a33faf75be', # from svn revision 566

'src/third_party/freetype/src':
Var('chromium_git') + '/chromium/src/third_party/freetype2.git' + '@' + Var('freetype_revision'),

Expand All @@ -156,6 +150,9 @@ deps = {
'src/third_party/colorama/src':
Var('chromium_git') + '/external/colorama.git' + '@' + '799604a1041e9b3bc5d2789ecbd7e8db2e18e6b8',

'src/third_party/googletest/src':
Var('chromium_git') + '/external/github.com/google/googletest.git' + '@' + 'ec44c6c1675c25b9827aacd08c02433cccde7780',

'src/third_party/icu':
Var('chromium_git') + '/chromium/deps/icu.git' + '@' + 'b34251f8b762f8e2112a89c587855ca4297fed96',

Expand Down
2 changes: 1 addition & 1 deletion base/gtest_prod_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef BASE_GTEST_PROD_UTIL_H_
#define BASE_GTEST_PROD_UTIL_H_

#include "testing/gtest/include/gtest/gtest_prod.h"
#include "testing/gtest/include/gtest/gtest_prod.h" // nogncheck

// This is a wrapper for gtest's FRIEND_TEST macro that friends
// test with all possible prefixes. This is very helpful when changing the test
Expand Down
7 changes: 7 additions & 0 deletions build/secondary/testing/gmock/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Chromium's GN configuration for gmock now lives at testing/gmock/BUILD.gn.
#
# This configuration is left in the tree because it is pulled by V8 and PDFium,
# and will be removed as soon as the projects switch off of it.
#
# Details at http://crbug.com/630705 and http://crrev.com/2779193002

config("gmock_config") {
# Gmock headers need to be able to find themselves.
include_dirs = [
Expand Down
7 changes: 7 additions & 0 deletions build/secondary/testing/gtest/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Chromium's GN configuration for gtest now lives at testing/gtest/BUILD.gn.
#
# This configuration is left in the tree because it is pulled by V8 and PDFium,
# and will be removed as soon as the projects switch off of it.
#
# Details at http://crbug.com/630705 and http://crrev.com/2779193002

import("//build_overrides/gtest.gni")

config("gtest_config") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "dbus/object_path.h"
#include "device/bluetooth/bluetooth_export.h"
#include "device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
#include "testing/gtest/include/gtest/gtest_prod.h" // nogncheck

namespace bluez {

Expand Down
4 changes: 2 additions & 2 deletions net/socket/sequenced_socket_data_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -671,8 +671,8 @@ TEST_F(SequencedSocketDataTest, SingleSyncWriteTooSmall) {

static const char* kExpectedFailures[] = {
"Expected: (data.length()) >= (expected_data.length())",
"Value of: actual_data",
"Value of: sock_->Write(buf.get(), len, failing_callback_)"};
"To be equal to: actual_data",
"To be equal to: sock_->Write(buf.get(), len, failing_callback_)"};
ASSERT_EQ(arraysize(kExpectedFailures),
static_cast<size_t>(gtest_failures.size()));

Expand Down
34 changes: 34 additions & 0 deletions testing/gmock/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 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.

# The file/directory layout of Google Test is not yet considered stable. Until
# it stabilizes, Chromium code MUST use this target instead of reaching directly
# into //third_party/googletest.
source_set("gmock") {
testonly = true
sources = [
"include/gmock/gmock-actions.h",
"include/gmock/gmock-generated-function-mockers.h",
"include/gmock/gmock-matchers.h",
"include/gmock/gmock.h",
]
deps = [
"//third_party/googletest:gmock",
]

public_configs = [
"//third_party/googletest:gmock_config",
"//third_party/googletest:gtest_config",
]
}

# The file/directory layout of Google Test is not yet considered stable. Until
# it stabilizes, Chromium code MUST use this target instead of reaching directly
# into //third_party/googletest.
source_set("gmock_main") {
testonly = true
deps = [
"//third_party/googletest:gmock_main",
]
}
2 changes: 2 additions & 0 deletions testing/gmock/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
thakis@chromium.org
pwnall@chromium.org
10 changes: 10 additions & 0 deletions testing/gmock/include/gmock/gmock-actions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright 2017 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.

// The file/directory layout of Google Test is not yet considered stable. Until
// it stabilizes, Chromium code will use forwarding headers in testing/gtest
// and testing/gmock, instead of directly including files in
// third_party/googletest.

#include "third_party/googletest/src/googlemock/include/gmock/gmock-actions.h"
10 changes: 10 additions & 0 deletions testing/gmock/include/gmock/gmock-generated-function-mockers.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright 2017 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.

// The file/directory layout of Google Test is not yet considered stable. Until
// it stabilizes, Chromium code will use forwarding headers in testing/gtest
// and testing/gmock, instead of directly including files in
// third_party/googletest.

#include "third_party/googletest/src/googlemock/include/gmock/gmock-generated-function-mockers.h"
10 changes: 10 additions & 0 deletions testing/gmock/include/gmock/gmock-matchers.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright 2017 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.

// The file/directory layout of Google Test is not yet considered stable. Until
// it stabilizes, Chromium code will use forwarding headers in testing/gtest
// and testing/gmock, instead of directly including files in
// third_party/googletest.

#include "third_party/googletest/src/googlemock/include/gmock/gmock-matchers.h"
10 changes: 10 additions & 0 deletions testing/gmock/include/gmock/gmock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright 2017 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.

// The file/directory layout of Google Test is not yet considered stable. Until
// it stabilizes, Chromium code will use forwarding headers in testing/gtest
// and testing/gmock, instead of directly including files in
// third_party/googletest.

#include "third_party/googletest/src/googlemock/include/gmock/gmock.h"
85 changes: 85 additions & 0 deletions testing/gtest/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# 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.

import("//build_overrides/gtest.gni")

config("gtest_direct_config") {
visibility = [ ":*" ]
defines = [ "UNIT_TEST" ]
}

# The file/directory layout of Google Test is not yet considered stable. Until
# it stabilizes, Chromium code MUST use this target instead of reaching directly
# into //third_party/googletest.
static_library("gtest") {
testonly = true

sources = [
"include/gtest/gtest-death-test.h",
"include/gtest/gtest-message.h",
"include/gtest/gtest-param-test.h",
"include/gtest/gtest-spi.h",
"include/gtest/gtest.h",
"include/gtest/gtest_prod.h",

# This is a workaround for the issues below.
#
# 1) This target needs to be a static_library (not a source set) on Mac to
# avoid the build errors in
# https://codereview.chromium.org/2779193002#msg82.
# 2) A static_library must have at least one source file, to avoid build
# errors on Mac and Windows. https://crbug.com/710334
# 3) A static_library with complete_static_lib = true, which would not
# require adding the empty file, will result in duplicate symbols on
# Android. https://codereview.chromium.org/2852613002/#ps20001
"empty.cc",
]
deps = [
"//third_party/googletest:gtest",
]

public_configs = [ ":gtest_direct_config" ]

if (gtest_include_multiprocess) {
sources += [
"../multiprocess_func_list.cc",
"../multiprocess_func_list.h",
]
}

if (gtest_include_platform_test) {
sources += [ "../platform_test.h" ]
}

if ((is_mac || is_ios) && gtest_include_objc_support) {
if (is_ios) {
set_sources_assignment_filter([])
}
sources += [
"../gtest_mac.h",
"../gtest_mac.mm",
]
if (gtest_include_platform_test) {
sources += [ "../platform_test_mac.mm" ]
}
set_sources_assignment_filter(sources_assignment_filter)
}

if (is_ios && gtest_include_ios_coverage) {
sources += [
"../coverage_util_ios.cc",
"../coverage_util_ios.h",
]
}
}

# The file/directory layout of Google Test is not yet considered stable. Until
# it stabilizes, Chromium code MUST use this target instead of reaching directly
# into //third_party/googletest.
source_set("gtest_main") {
testonly = true
deps = [
"//third_party/googletest:gtest_main",
]
}
2 changes: 2 additions & 0 deletions testing/gtest/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
thakis@chromium.org
pwnall@chromium.org
3 changes: 3 additions & 0 deletions testing/gtest/empty.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// 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.
10 changes: 10 additions & 0 deletions testing/gtest/include/gtest/gtest-death-test.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright 2017 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.

// The file/directory layout of Google Test is not yet considered stable. Until
// it stabilizes, Chromium code will use forwarding headers in testing/gtest
// and testing/gmock, instead of directly including files in
// third_party/googletest.

#include "third_party/googletest/src/googletest/include/gtest/gtest-death-test.h"
10 changes: 10 additions & 0 deletions testing/gtest/include/gtest/gtest-message.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright 2017 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.

// The file/directory layout of Google Test is not yet considered stable. Until
// it stabilizes, Chromium code will use forwarding headers in testing/gtest
// and testing/gmock, instead of directly including files in
// third_party/googletest.

#include "third_party/googletest/src/googletest/include/gtest/gtest-message.h"
10 changes: 10 additions & 0 deletions testing/gtest/include/gtest/gtest-param-test.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright 2017 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.

// The file/directory layout of Google Test is not yet considered stable. Until
// it stabilizes, Chromium code will use forwarding headers in testing/gtest
// and testing/gmock, instead of directly including files in
// third_party/googletest.

#include "third_party/googletest/src/googletest/include/gtest/gtest-param-test.h"
10 changes: 10 additions & 0 deletions testing/gtest/include/gtest/gtest-spi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright 2017 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.

// The file/directory layout of Google Test is not yet considered stable. Until
// it stabilizes, Chromium code will use forwarding headers in testing/gtest
// and testing/gmock, instead of directly including files in
// third_party/googletest.

#include "third_party/googletest/src/googletest/include/gtest/gtest-spi.h"
10 changes: 10 additions & 0 deletions testing/gtest/include/gtest/gtest.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright 2017 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.

// The file/directory layout of Google Test is not yet considered stable. Until
// it stabilizes, Chromium code will use forwarding headers in testing/gtest
// and testing/gmock, instead of directly including files in
// third_party/googletest.

#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
10 changes: 10 additions & 0 deletions testing/gtest/include/gtest/gtest_prod.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright 2017 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.

// The file/directory layout of Google Test is not yet considered stable. Until
// it stabilizes, Chromium code will use forwarding headers in testing/gtest
// and testing/gmock, instead of directly including files in
// third_party/googletest.

#include "third_party/googletest/src/googletest/include/gtest/gtest_prod.h"
4 changes: 2 additions & 2 deletions testing/gtest_mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#ifndef TESTING_GTEST_MAC_H_
#define TESTING_GTEST_MAC_H_

#include <gtest/internal/gtest-port.h>
#include <gtest/gtest.h>
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/googletest/src/googletest/include/gtest/internal/gtest-port.h"

#ifdef GTEST_OS_MAC

Expand Down
6 changes: 3 additions & 3 deletions testing/gtest_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

#include <string>

#include <gtest/gtest.h>
#include <gtest/internal/gtest-port.h>
#include <gtest/internal/gtest-string.h>
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/googletest/src/googletest/include/gtest/internal/gtest-port.h"
#include "third_party/googletest/src/googletest/include/gtest/internal/gtest-string.h"

#ifdef GTEST_OS_MAC

Expand Down
2 changes: 1 addition & 1 deletion testing/gtest_mac_unittest.mm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include "base/mac/scoped_nsautorelease_pool.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/gtest/include/gtest/internal/gtest-port.h"
#include "third_party/googletest/src/googletest/include/gtest/internal/gtest-port.h"

TEST(GTestMac, ExpectNSEQ) {
base::mac::ScopedNSAutoreleasePool pool;
Expand Down
1 change: 1 addition & 0 deletions third_party/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
/google_appengine_cloudstorage
/google_toolbox_for_mac/src
/googlemac
/googletest/src
/gvr-android-sdk/common_library.aar
/gvr-android-sdk/test-libraries/controller_test_api.aar
/gvr-android-sdk/libgvr_shim_static_arm.a
Expand Down
Loading

0 comments on commit dbcef9b

Please sign in to comment.