aboutsummaryrefslogtreecommitdiff
path: root/cast/common
diff options
context:
space:
mode:
authorJordan Bayles <jophba@chromium.org>2020-06-02 15:51:31 -0700
committerCommit Bot <commit-bot@chromium.org>2020-06-03 14:49:40 +0000
commitc9201dd611b0aa8d66fe7ef2749c7ce0c157f0a1 (patch)
tree35865dd50de7765c9c82abb42c74a7d70a4b8178 /cast/common
parent724a60fb10c7042a3e00eb4f1cf25b41b88b0c8b (diff)
downloadopenscreen-c9201dd611b0aa8d66fe7ef2749c7ce0c157f0a1.tar.gz
Move std::chrono using statements to util/
This patch moves openscreen::<time type> using statements to be part of a new util/ header, chrono_helpers.h. Some helpful convenience functions are provided for doing conversions, and a new conversion method, to_duration, is added to the Clock implementation. Change-Id: I5a153c4da5266bceea97de0cad00a71a739f71ca Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2222684 Reviewed-by: mark a. foltz <mfoltz@chromium.org> Reviewed-by: Ryan Keane <rwkeane@google.com> Commit-Queue: Jordan Bayles <jophba@chromium.org>
Diffstat (limited to 'cast/common')
-rw-r--r--cast/common/certificate/cast_cert_validator_internal.cc1
-rw-r--r--cast/common/discovery/e2e_test/tests.cc15
2 files changed, 8 insertions, 8 deletions
diff --git a/cast/common/certificate/cast_cert_validator_internal.cc b/cast/common/certificate/cast_cert_validator_internal.cc
index 8284802e..569d22b1 100644
--- a/cast/common/certificate/cast_cert_validator_internal.cc
+++ b/cast/common/certificate/cast_cert_validator_internal.cc
@@ -10,6 +10,7 @@
#include <openssl/x509v3.h>
#include <time.h>
+#include <string>
#include <vector>
#include "cast/common/certificate/types.h"
diff --git a/cast/common/discovery/e2e_test/tests.cc b/cast/common/discovery/e2e_test/tests.cc
index 0d281dc7..90f5f824 100644
--- a/cast/common/discovery/e2e_test/tests.cc
+++ b/cast/common/discovery/e2e_test/tests.cc
@@ -20,20 +20,19 @@
#include "platform/impl/network_interface.h"
#include "platform/impl/platform_client_posix.h"
#include "platform/impl/task_runner.h"
+#include "util/chrono_helpers.h"
namespace openscreen {
namespace cast {
namespace {
// Total wait time = 4 seconds.
-constexpr std::chrono::milliseconds kWaitLoopSleepTime =
- std::chrono::milliseconds(500);
+constexpr milliseconds kWaitLoopSleepTime(500);
constexpr int kMaxWaitLoopIterations = 8;
// Total wait time = 2.5 seconds.
// NOTE: This must be less than the above wait time.
-constexpr std::chrono::milliseconds kCheckLoopSleepTime =
- std::chrono::milliseconds(100);
+constexpr milliseconds kCheckLoopSleepTime(100);
constexpr int kMaxCheckLoopIterations = 25;
@@ -132,9 +131,9 @@ class DiscoveryE2ETest : public testing::Test {
public:
DiscoveryE2ETest() {
// Sleep to let any packets clear off the network before further tests.
- std::this_thread::sleep_for(std::chrono::milliseconds(500));
+ std::this_thread::sleep_for(milliseconds(500));
- PlatformClientPosix::Create(milliseconds{50}, milliseconds{50});
+ PlatformClientPosix::Create(milliseconds(50), milliseconds(50));
task_runner_ = PlatformClientPosix::GetInstance()->GetTaskRunner();
}
@@ -422,7 +421,7 @@ TEST_F(DiscoveryE2ETest, ValidateAnnouncementFlow) {
ASSERT_FALSE(result.is_error());
ASSERT_EQ(result.value(), 3);
});
- std::this_thread::sleep_for(std::chrono::seconds(3));
+ std::this_thread::sleep_for(seconds(3));
found1 = false;
found2 = false;
found3 = false;
@@ -524,7 +523,7 @@ TEST_F(DiscoveryE2ETest, ValidateRefreshFlow) {
auto discovery_config = GetConfigSettings();
discovery_config.new_record_announcement_count = 0;
discovery_config.new_query_announcement_count = 2;
- constexpr std::chrono::seconds kMaxQueryDuration{3};
+ constexpr seconds kMaxQueryDuration{3};
SetUpService(discovery_config);
auto instance = GetInfo(1);