summaryrefslogtreecommitdiff
path: root/chromium/media/audio/sounds/test_data.cc
blob: dc667c9996d567bed9418ec29edc82394722d933 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright 2013 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 "media/audio/sounds/test_data.h"

#include "base/logging.h"
#include "base/message_loop/message_loop.h"

namespace media {

TestObserver::TestObserver(const base::Closure& quit)
    : loop_(base::MessageLoop::current()),
      quit_(quit),
      num_play_requests_(0),
      num_stop_requests_(0),
      cursor_(0) {
  DCHECK(loop_);
}

TestObserver::~TestObserver() {
}

void TestObserver::OnPlay() {
  ++num_play_requests_;
}

void TestObserver::OnStop(size_t cursor) {
  ++num_stop_requests_;
  cursor_ = cursor;
  loop_->PostTask(FROM_HERE, quit_);
}

}  // namespace media