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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 // Simulate a device change where no output devices are available. | 40 // Simulate a device change where no output devices are available. |
41 bool SimulateNullDefaultOutputDeviceChange() { | 41 bool SimulateNullDefaultOutputDeviceChange() { |
42 return output_device_listener_->OnDefaultDeviceChanged( | 42 return output_device_listener_->OnDefaultDeviceChanged( |
43 static_cast<EDataFlow>(eConsole), static_cast<ERole>(eRender), | 43 static_cast<EDataFlow>(eConsole), static_cast<ERole>(eRender), |
44 NULL) == S_OK; | 44 NULL) == S_OK; |
45 } | 45 } |
46 | 46 |
47 bool SimulateDefaultOutputDeviceChange(const char* new_device_id) { | 47 bool SimulateDefaultOutputDeviceChange(const char* new_device_id) { |
48 return output_device_listener_->OnDefaultDeviceChanged( | 48 return output_device_listener_->OnDefaultDeviceChanged( |
49 static_cast<EDataFlow>(eConsole), static_cast<ERole>(eRender), | 49 static_cast<EDataFlow>(eConsole), static_cast<ERole>(eRender), |
50 ASCIIToWide(new_device_id).c_str()) == S_OK; | 50 base::ASCIIToWide(new_device_id).c_str()) == S_OK; |
51 } | 51 } |
52 | 52 |
53 void SetOutputDeviceId(std::string new_device_id) { | 53 void SetOutputDeviceId(std::string new_device_id) { |
54 output_device_listener_->default_render_device_id_ = new_device_id; | 54 output_device_listener_->default_render_device_id_ = new_device_id; |
55 } | 55 } |
56 | 56 |
57 MOCK_METHOD0(OnDeviceChange, void()); | 57 MOCK_METHOD0(OnDeviceChange, void()); |
58 | 58 |
59 private: | 59 private: |
60 ScopedCOMInitializer com_init_; | 60 ScopedCOMInitializer com_init_; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 testing::Mock::VerifyAndClear(this); | 94 testing::Mock::VerifyAndClear(this); |
95 EXPECT_CALL(*this, OnDeviceChange()).Times(1); | 95 EXPECT_CALL(*this, OnDeviceChange()).Times(1); |
96 ASSERT_TRUE(SimulateDefaultOutputDeviceChange(kFirstTestDevice)); | 96 ASSERT_TRUE(SimulateDefaultOutputDeviceChange(kFirstTestDevice)); |
97 | 97 |
98 testing::Mock::VerifyAndClear(this); | 98 testing::Mock::VerifyAndClear(this); |
99 EXPECT_CALL(*this, OnDeviceChange()).Times(1); | 99 EXPECT_CALL(*this, OnDeviceChange()).Times(1); |
100 ASSERT_TRUE(SimulateNullDefaultOutputDeviceChange()); | 100 ASSERT_TRUE(SimulateNullDefaultOutputDeviceChange()); |
101 } | 101 } |
102 | 102 |
103 } // namespace media | 103 } // namespace media |
OLD | NEW |