| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 5 #include "base/bind.h" | 
| 6 #include "base/environment.h" | 6 #include "base/environment.h" | 
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" | 
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" | 
| 9 #include "base/process_util.h" | 9 #include "base/process_util.h" | 
| 10 #include "base/sync_socket.h" | 10 #include "base/sync_socket.h" | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
| 25 using ::testing::InSequence; | 25 using ::testing::InSequence; | 
| 26 using ::testing::InvokeWithoutArgs; | 26 using ::testing::InvokeWithoutArgs; | 
| 27 using ::testing::Return; | 27 using ::testing::Return; | 
| 28 using ::testing::SaveArg; | 28 using ::testing::SaveArg; | 
| 29 using ::testing::SetArgumentPointee; | 29 using ::testing::SetArgumentPointee; | 
| 30 using content::BrowserThread; | 30 using content::BrowserThread; | 
| 31 | 31 | 
| 32 using content::BrowserThreadImpl; | 32 using content::BrowserThreadImpl; | 
| 33 | 33 | 
| 34 static const int kStreamId = 50; | 34 static const int kStreamId = 50; | 
|  | 35 static const int kRenderViewId = -2; | 
| 35 | 36 | 
| 36 static bool IsRunningHeadless() { | 37 static bool IsRunningHeadless() { | 
| 37   scoped_ptr<base::Environment> env(base::Environment::Create()); | 38   scoped_ptr<base::Environment> env(base::Environment::Create()); | 
| 38   if (env->HasVar("CHROME_HEADLESS")) | 39   if (env->HasVar("CHROME_HEADLESS")) | 
| 39     return true; | 40     return true; | 
| 40   return false; | 41   return false; | 
| 41 } | 42 } | 
| 42 | 43 | 
| 43 class MockAudioRendererHost : public AudioRendererHost { | 44 class MockAudioRendererHost : public AudioRendererHost { | 
| 44  public: | 45  public: | 
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 206     else | 207     else | 
| 207       format = media::AudioParameters::AUDIO_PCM_LINEAR; | 208       format = media::AudioParameters::AUDIO_PCM_LINEAR; | 
| 208 | 209 | 
| 209     media::AudioParameters params( | 210     media::AudioParameters params( | 
| 210         format, CHANNEL_LAYOUT_STEREO, | 211         format, CHANNEL_LAYOUT_STEREO, | 
| 211         media::AudioParameters::kAudioCDSampleRate, 16, | 212         media::AudioParameters::kAudioCDSampleRate, 16, | 
| 212         media::AudioParameters::kAudioCDSampleRate / 10); | 213         media::AudioParameters::kAudioCDSampleRate / 10); | 
| 213 | 214 | 
| 214     // Send a create stream message to the audio output stream and wait until | 215     // Send a create stream message to the audio output stream and wait until | 
| 215     // we receive the created message. | 216     // we receive the created message. | 
| 216     host_->OnCreateStream(kStreamId, params); | 217     host_->OnCreateStream(kRenderViewId, kStreamId, params); | 
| 217     message_loop_->Run(); | 218     message_loop_->Run(); | 
| 218   } | 219   } | 
| 219 | 220 | 
| 220   void Close() { | 221   void Close() { | 
| 221     EXPECT_CALL(*observer_, | 222     EXPECT_CALL(*observer_, | 
| 222                 OnSetAudioStreamStatus(_, kStreamId, "closed")); | 223                 OnSetAudioStreamStatus(_, kStreamId, "closed")); | 
| 223 | 224 | 
| 224     // Send a message to AudioRendererHost to tell it we want to close the | 225     // Send a message to AudioRendererHost to tell it we want to close the | 
| 225     // stream. | 226     // stream. | 
| 226     host_->OnCloseStream(kStreamId); | 227     host_->OnCloseStream(kStreamId); | 
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 403     EnableRealDevice(); | 404     EnableRealDevice(); | 
| 404 | 405 | 
| 405   Create(); | 406   Create(); | 
| 406   Play(); | 407   Play(); | 
| 407   SimulateError(); | 408   SimulateError(); | 
| 408   Close(); | 409   Close(); | 
| 409 } | 410 } | 
| 410 | 411 | 
| 411 | 412 | 
| 412 // TODO(hclam): Add tests for data conversation in low latency mode. | 413 // TODO(hclam): Add tests for data conversation in low latency mode. | 
| OLD | NEW | 
|---|