• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "media/audio/sounds/test_data.h"
6 
7 #include "base/logging.h"
8 #include "base/message_loop/message_loop.h"
9 
10 namespace media {
11 
TestObserver(const base::Closure & quit)12 TestObserver::TestObserver(const base::Closure& quit)
13     : loop_(base::MessageLoop::current()),
14       quit_(quit),
15       num_play_requests_(0),
16       num_stop_requests_(0),
17       cursor_(0) {
18   DCHECK(loop_);
19 }
20 
~TestObserver()21 TestObserver::~TestObserver() {
22 }
23 
OnPlay()24 void TestObserver::OnPlay() {
25   ++num_play_requests_;
26 }
27 
OnStop(size_t cursor)28 void TestObserver::OnStop(size_t cursor) {
29   ++num_stop_requests_;
30   cursor_ = cursor;
31   loop_->PostTask(FROM_HERE, quit_);
32 }
33 
34 }  // namespace media
35