Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Unified Diff: components/copresence/handlers/audio/audio_directive_list.cc

Issue 665353002: Add AudioDirectiveHandler timed tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@audio_redesign
Patch Set: build fix. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/copresence/handlers/audio/audio_directive_list.cc
diff --git a/components/copresence/handlers/audio/audio_directive_list.cc b/components/copresence/handlers/audio/audio_directive_list.cc
index 8b9b76ec21d1945b9955ea17bba27e41e8b892c1..2060ef51048316ebcf4fa41a773c87b88096c702 100644
--- a/components/copresence/handlers/audio/audio_directive_list.cc
+++ b/components/copresence/handlers/audio/audio_directive_list.cc
@@ -8,8 +8,8 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/time/default_tick_clock.h"
-#include "base/time/tick_clock.h"
#include "base/time/time.h"
+#include "components/copresence/handlers/audio/tick_clock_ref_counted.h"
namespace copresence {
@@ -23,7 +23,9 @@ AudioDirective::AudioDirective(const std::string& op_id,
: op_id(op_id), end_time(end_time) {
}
-AudioDirectiveList::AudioDirectiveList() : clock_(new base::DefaultTickClock) {
+AudioDirectiveList::AudioDirectiveList()
+ : clock_(new TickClockRefCounted(
+ make_scoped_ptr(new base::DefaultTickClock))) {
}
AudioDirectiveList::~AudioDirectiveList() {
@@ -75,6 +77,13 @@ scoped_ptr<AudioDirective> AudioDirectiveList::GetActiveDirective() {
return make_scoped_ptr(new AudioDirective(active_directives_.front()));
}
+void AudioDirectiveList::set_clock_for_testing(
+ const scoped_refptr<TickClockRefCounted>& clock) {
+ clock_ = clock;
+}
+
+// Private methods.
+
std::vector<AudioDirective>::iterator AudioDirectiveList::FindDirectiveByOpId(
const std::string& op_id) {
for (std::vector<AudioDirective>::iterator it = active_directives_.begin();

Powered by Google App Engine
This is Rietveld 408576698