Commit 75389fd0 authored by Luum Habtemariam's avatar Luum Habtemariam Committed by Commit Bot

Enabling CUPS dependent tests in ChromeOS VM trybot

The new CupsProxyService adds more libCUPS dependent code to Chrome, but
it doesn't look like any of the trybots currently run them. This change
combines the new tests into a new target set to run in the
ChromeOS VM trybot (chromeos-amd64-generic-rel).

Bug: chromium:945409
Test: trybot runs and passes
Change-Id: I4ef5724a3d4b0923fba3abcd7fde8bb744209c2b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1797002Reviewed-by: default avatarKen Rockot <rockot@google.com>
Reviewed-by: default avatarSean Kau <skau@chromium.org>
Reviewed-by: default avatarBen Pastene <bpastene@chromium.org>
Commit-Queue: Luum Habtemariam <luum@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713269}
parent aac524df
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
import("//build/config/features.gni") import("//build/config/features.gni")
import("//printing/buildflags/buildflags.gni") import("//printing/buildflags/buildflags.gni")
import("//testing/test.gni")
assert(is_chromeos, "Non-ChromeOS builds must not depend on this") assert(is_chromeos, "Non-ChromeOS builds must not depend on this")
assert(use_cups, "Non-CUPS builds must not depend on this") assert(use_cups, "Non-CUPS builds must not depend on this")
...@@ -54,7 +55,7 @@ static_library("test_support") { ...@@ -54,7 +55,7 @@ static_library("test_support") {
] ]
} }
source_set("unit_tests") { test("libcups_unittests") {
testonly = true testonly = true
sources = [ sources = [
"ipp_validator_unittest.cc", "ipp_validator_unittest.cc",
...@@ -62,16 +63,23 @@ source_set("unit_tests") { ...@@ -62,16 +63,23 @@ source_set("unit_tests") {
"socket_manager_unittest.cc", "socket_manager_unittest.cc",
] ]
configs += [ "//printing:cups" ]
deps = [ deps = [
":cups_proxy", ":cups_proxy",
":test_support", ":test_support",
"//base", "//base",
"//base/test:test_support",
"//chrome/common",
"//chrome/services/cups_proxy/public/cpp", "//chrome/services/cups_proxy/public/cpp",
"//chrome/services/cups_proxy/public/cpp:unit_tests", "//chrome/services/cups_proxy/public/cpp:unit_tests",
"//chrome/services/cups_proxy/test:test_support",
"//chromeos",
"//testing/gmock",
"//testing/gtest", "//testing/gtest",
] ]
data = [ data = [
"//chrome/test/data/cups_proxy", "//chrome/services/cups_proxy/test/data",
] ]
} }
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "chrome/services/cups_proxy/fake_cups_proxy_service_delegate.h" #include "chrome/services/cups_proxy/fake_cups_proxy_service_delegate.h"
#include "chrome/services/cups_proxy/public/cpp/type_conversions.h" #include "chrome/services/cups_proxy/public/cpp/type_conversions.h"
#include "chrome/services/cups_proxy/socket_manager.h" #include "chrome/services/cups_proxy/socket_manager.h"
#include "chrome/services/cups_proxy/test/paths.h"
#include "net/base/io_buffer.h" #include "net/base/io_buffer.h"
#include "net/socket/unix_domain_client_socket_posix.h" #include "net/socket/unix_domain_client_socket_posix.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -23,22 +24,17 @@ ...@@ -23,22 +24,17 @@
namespace cups_proxy { namespace cups_proxy {
namespace { namespace {
// CupsProxy testing data relative path.
const base::FilePath::CharType kCupsProxyDataDirectory[] =
FILE_PATH_LITERAL("cups_proxy");
// Returns base::nullopt on failure. // Returns base::nullopt on failure.
base::Optional<std::string> GetTestFile(std::string test_name) { base::Optional<std::string> GetTestFile(std::string test_name) {
base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedAllowBlockingForTesting allow_blocking;
// Build file path. // Build file path.
base::FilePath path; base::FilePath path;
if (!base::PathService::Get(chrome::DIR_TEST_DATA, &path)) { if (!base::PathService::Get(Paths::DIR_TEST_DATA, &path)) {
return base::nullopt; return base::nullopt;
} }
path = path.Append(kCupsProxyDataDirectory) path = path.Append(FILE_PATH_LITERAL(test_name))
.Append(FILE_PATH_LITERAL(test_name))
.AddExtension(FILE_PATH_LITERAL(".bin")); .AddExtension(FILE_PATH_LITERAL(".bin"));
// Read in file contents. // Read in file contents.
......
# Copyright 2019 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/config/features.gni")
import("//printing/buildflags/buildflags.gni")
import("//testing/test.gni")
assert(is_chromeos, "Non-ChromeOS builds must not depend on this")
assert(use_cups, "Non-CUPS builds must not depend on this")
source_set("test_support") {
testonly = true
sources = [
"libcups_test_suite.cc",
"libcups_test_suite.h",
"paths.cc",
"paths.h",
"run_all_unittests.cc",
]
deps = [
"//base",
"//base/test:test_support",
"//mojo/core/embedder",
"//testing/gmock",
"//testing/gtest",
]
}
include_rules = [
"+mojo/core/embedder",
]
// Copyright 2019 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 "chrome/services/cups_proxy/test/libcups_test_suite.h"
#include "chrome/services/cups_proxy/test/paths.h"
namespace cups_proxy {
LibCupsTestSuite::LibCupsTestSuite(int argc, char** argv)
: base::TestSuite(argc, argv) {}
LibCupsTestSuite::~LibCupsTestSuite() = default;
void LibCupsTestSuite::Initialize() {
base::TestSuite::Initialize();
Paths::RegisterPathProvider();
}
} // namespace cups_proxy
// Copyright 2019 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.
#ifndef CHROME_SERVICES_CUPS_PROXY_TEST_LIBCUPS_TEST_SUITE_H_
#define CHROME_SERVICES_CUPS_PROXY_TEST_LIBCUPS_TEST_SUITE_H_
#include <memory>
#include "base/macros.h"
#include "base/test/test_suite.h"
namespace cups_proxy {
class LibCupsTestSuite : public base::TestSuite {
public:
LibCupsTestSuite(int argc, char** argv);
~LibCupsTestSuite() override;
protected:
// base::TestSuite:
void Initialize() override;
private:
DISALLOW_COPY_AND_ASSIGN(LibCupsTestSuite);
};
} // namespace cups_proxy
#endif // CHROME_SERVICES_CUPS_PROXY_TEST_LIBCUPS_TEST_SUITE_H_
// Copyright 2019 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 "chrome/services/cups_proxy/test/paths.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/path_service.h"
namespace cups_proxy {
bool PathProvider(int key, base::FilePath* result) {
base::FilePath cur;
switch (key) {
// The following are only valid in the development environment, and
// will fail if executed from an installed executable (because the
// generated path won't exist).
case Paths::DIR_TEST_DATA:
if (!base::PathService::Get(base::DIR_SOURCE_ROOT, &cur))
return false;
cur = cur.Append(FILE_PATH_LITERAL("chrome"));
cur = cur.Append(FILE_PATH_LITERAL("services"));
cur = cur.Append(FILE_PATH_LITERAL("cups_proxy"));
cur = cur.Append(FILE_PATH_LITERAL("test"));
cur = cur.Append(FILE_PATH_LITERAL("data"));
if (!base::PathExists(cur)) // we don't want to create this
return false;
break;
default:
return false;
}
*result = cur;
return true;
}
// This cannot be done as a static initializer sadly since Visual Studio will
// eliminate this object file if there is no direct entry point into it.
void Paths::RegisterPathProvider() {
base::PathService::RegisterProvider(PathProvider, PATH_START, PATH_END);
}
} // namespace cups_proxy
// Copyright 2019 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.
#ifndef CHROME_SERVICES_CUPS_PROXY_TEST_PATHS_H_
#define CHROME_SERVICES_CUPS_PROXY_TEST_PATHS_H_
namespace cups_proxy {
class Paths {
public:
enum {
PATH_START = 1000,
// Valid only in development and testing environments.
DIR_TEST_DATA,
PATH_END
};
// Call once to register the provider for the path keys defined above.
static void RegisterPathProvider();
};
} // namespace cups_proxy
#endif // CHROME_SERVICES_CUPS_PROXY_TEST_PATHS_H_
// Copyright (c) 2019 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/bind.h"
#include "base/command_line.h"
#include "base/test/launcher/unit_test_launcher.h"
#include "build/build_config.h"
#include "mojo/core/embedder/embedder.h"
#include "chrome/services/cups_proxy/test/libcups_test_suite.h"
int main(int argc, char** argv) {
cups_proxy::LibCupsTestSuite test_suite(argc, argv);
mojo::core::Init();
return base::LaunchUnitTests(argc, argv,
base::Bind(&cups_proxy::LibCupsTestSuite::Run,
base::Unretained(&test_suite)));
}
...@@ -4804,9 +4804,6 @@ test("unit_tests") { ...@@ -4804,9 +4804,6 @@ test("unit_tests") {
data_deps += [ "//testing/buildbot/filters:chromeos_filters" ] data_deps += [ "//testing/buildbot/filters:chromeos_filters" ]
sources -= sources -=
[ "../browser/policy/cloud/user_policy_signin_service_unittest.cc" ] [ "../browser/policy/cloud/user_policy_signin_service_unittest.cc" ]
if (use_cups) {
deps += [ "//chrome/services/cups_proxy:unit_tests" ]
}
} }
if (use_x11) { if (use_x11) {
deps += [ "//ui/events/devices" ] deps += [ "//ui/events/devices" ]
......
...@@ -274,6 +274,24 @@ ...@@ -274,6 +274,24 @@
}, },
"test": "latency_unittests" "test": "latency_unittests"
}, },
{
"experiment_percentage": 100,
"merge": {
"args": [],
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
"swarming": {
"can_use_on_swarming_builders": true,
"dimension_sets": [
{
"kvm": "1",
"os": "Ubuntu-16.04",
"pool": "chrome.tests.cros-vm"
}
]
},
"test": "libcups_unittests"
},
{ {
"args": [ "args": [
"--test-launcher-filter-file=../../testing/buildbot/filters/chromeos.media_unittests.filter" "--test-launcher-filter-file=../../testing/buildbot/filters/chromeos.media_unittests.filter"
......
...@@ -289,6 +289,24 @@ ...@@ -289,6 +289,24 @@
}, },
"test": "latency_unittests" "test": "latency_unittests"
}, },
{
"experiment_percentage": 100,
"merge": {
"args": [],
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
"swarming": {
"can_use_on_swarming_builders": true,
"dimension_sets": [
{
"kvm": "1",
"os": "Ubuntu-16.04",
"pool": "Chrome-CrOS-VM"
}
]
},
"test": "libcups_unittests"
},
{ {
"args": [ "args": [
"--test-launcher-filter-file=../../testing/buildbot/filters/chromeos.media_unittests.filter" "--test-launcher-filter-file=../../testing/buildbot/filters/chromeos.media_unittests.filter"
......
...@@ -11211,6 +11211,27 @@ ...@@ -11211,6 +11211,27 @@
}, },
"test": "latency_unittests" "test": "latency_unittests"
}, },
{
"experiment_percentage": 100,
"isolate_coverage_data": true,
"merge": {
"args": [],
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
"swarming": {
"can_use_on_swarming_builders": true,
"dimension_sets": [
{
"kvm": "1",
"os": "Ubuntu-16.04",
"pool": "Chrome-CrOS-VM"
}
],
"hard_timeout": 3600,
"io_timeout": 3600
},
"test": "libcups_unittests"
},
{ {
"args": [ "args": [
"--test-launcher-filter-file=../../testing/buildbot/filters/chromeos.media_unittests.filter" "--test-launcher-filter-file=../../testing/buildbot/filters/chromeos.media_unittests.filter"
......
...@@ -1527,6 +1527,10 @@ ...@@ -1527,6 +1527,10 @@
"label": "//third_party/libaddressinput:libaddressinput_parse_format_rule_fuzzer", "label": "//third_party/libaddressinput:libaddressinput_parse_format_rule_fuzzer",
"type": "fuzzer", "type": "fuzzer",
}, },
"libcups_unittests": {
"label": "//chrome/services/cups_proxy:libcups_unittests",
"type": "console_test_launcher",
},
"libjingle_xmpp_unittests": { "libjingle_xmpp_unittests": {
"label": "//third_party/libjingle_xmpp:libjingle_xmpp_unittests", "label": "//third_party/libjingle_xmpp:libjingle_xmpp_unittests",
"type": "console_test_launcher", "type": "console_test_launcher",
......
...@@ -499,6 +499,9 @@ ...@@ -499,6 +499,9 @@
'ipc_tests': {}, 'ipc_tests': {},
'jingle_unittests': {}, 'jingle_unittests': {},
'latency_unittests': {}, 'latency_unittests': {},
'libcups_unittests': {
'experiment_percentage': 100,
},
'media_unittests': { 'media_unittests': {
'args': [ 'args': [
'--test-launcher-filter-file=../../testing/buildbot/filters/chromeos.media_unittests.filter', '--test-launcher-filter-file=../../testing/buildbot/filters/chromeos.media_unittests.filter',
......
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