OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 ASSERT_TRUE(SoundsManager::Get()); | 47 ASSERT_TRUE(SoundsManager::Get()); |
48 | 48 |
49 base::RunLoop run_loop; | 49 base::RunLoop run_loop; |
50 TestObserver observer(run_loop.QuitClosure()); | 50 TestObserver observer(run_loop.QuitClosure()); |
51 | 51 |
52 SetObserverForTesting(&observer); | 52 SetObserverForTesting(&observer); |
53 | 53 |
54 ASSERT_TRUE(SoundsManager::Get()->Initialize( | 54 ASSERT_TRUE(SoundsManager::Get()->Initialize( |
55 kTestAudioKey, | 55 kTestAudioKey, |
56 base::StringPiece(kTestAudioData, arraysize(kTestAudioData)))); | 56 base::StringPiece(kTestAudioData, arraysize(kTestAudioData)))); |
57 ASSERT_EQ(41, | 57 ASSERT_EQ(20, |
58 SoundsManager::Get()->GetDuration(kTestAudioKey).InMicroseconds()); | 58 SoundsManager::Get()->GetDuration(kTestAudioKey).InMicroseconds()); |
59 ASSERT_TRUE(SoundsManager::Get()->Play(kTestAudioKey)); | 59 ASSERT_TRUE(SoundsManager::Get()->Play(kTestAudioKey)); |
60 run_loop.Run(); | 60 run_loop.Run(); |
61 | 61 |
62 ASSERT_EQ(1, observer.num_play_requests()); | 62 ASSERT_EQ(1, observer.num_play_requests()); |
63 ASSERT_EQ(1, observer.num_stop_requests()); | 63 ASSERT_EQ(1, observer.num_stop_requests()); |
64 ASSERT_EQ(4, observer.cursor()); | 64 ASSERT_EQ(4, observer.cursor()); |
65 | 65 |
66 SetObserverForTesting(NULL); | 66 SetObserverForTesting(NULL); |
67 } | 67 } |
68 | 68 |
69 } // namespace media | 69 } // namespace media |
OLD | NEW |