
bind.h, callback.h, callback_forward.h, and callback_helpers.h moved into /base/functional/. Update the include paths to directly include them in their new location. Bug: 1364441 Change-Id: I02c0598355824c72852287cc58c1b941298ed4ce Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4157074 Reviewed-by: Daniel Cheng <dcheng@chromium.org> Auto-Submit: Avi Drissman <avi@chromium.org> Owners-Override: Daniel Cheng <dcheng@chromium.org> Commit-Queue: Daniel Cheng <dcheng@chromium.org> Owners-Override: Avi Drissman <avi@chromium.org> Cr-Commit-Position: refs/heads/main@{#1091532}
58 lines
1.8 KiB
C++
58 lines
1.8 KiB
C++
// Copyright 2012 The Chromium Authors
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include <iostream>
|
|
|
|
#include "base/build_time.h"
|
|
#include "base/functional/bind.h"
|
|
#include "base/test/launcher/unit_test_launcher.h"
|
|
#include "build/build_config.h"
|
|
#include "net/socket/transport_client_socket_pool.h"
|
|
#include "net/test/net_test_suite.h"
|
|
#include "url/buildflags.h"
|
|
|
|
namespace {
|
|
|
|
bool VerifyBuildIsTimely() {
|
|
// This lines up with various //net security features, like Certificate
|
|
// Transparency or HPKP, in that they require the build time be less than 70
|
|
// days old. Moreover, operating on the assumption that tests are run against
|
|
// recently compiled builds, this also serves as a sanity check for the
|
|
// system clock, which should be close to the build date.
|
|
base::TimeDelta kMaxAge = base::Days(70);
|
|
|
|
base::Time build_time = base::GetBuildTime();
|
|
base::Time now = base::Time::Now();
|
|
|
|
if ((now - build_time).magnitude() <= kMaxAge)
|
|
return true;
|
|
|
|
std::cerr
|
|
<< "ERROR: This build is more than " << kMaxAge.InDays()
|
|
<< " days out of date.\n"
|
|
"This could indicate a problem with the device's clock, or the build "
|
|
"is simply too old.\n"
|
|
"See crbug.com/666821 for why this is a problem\n"
|
|
<< " base::Time::Now() --> " << now << " (" << now.ToInternalValue()
|
|
<< ")\n"
|
|
<< " base::GetBuildTime() --> " << build_time << " ("
|
|
<< build_time.ToInternalValue() << ")\n";
|
|
|
|
return false;
|
|
}
|
|
|
|
} // namespace
|
|
|
|
int main(int argc, char** argv) {
|
|
if (!VerifyBuildIsTimely())
|
|
return 1;
|
|
|
|
NetTestSuite test_suite(argc, argv);
|
|
net::TransportClientSocketPool::set_connect_backup_jobs_enabled(false);
|
|
|
|
return base::LaunchUnitTests(
|
|
argc, argv,
|
|
base::BindOnce(&NetTestSuite::Run, base::Unretained(&test_suite)));
|
|
}
|