Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: content/renderer/media/audio_message_filter_unittest.cc

Issue 2852803002: Remove base::SharedMemory::ShareToProcess. (Closed)
Patch Set: Compile error. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "content/common/media/audio_messages.h" 11 #include "content/common/media/audio_messages.h"
12 #include "content/renderer/media/audio_message_filter.h" 12 #include "content/renderer/media/audio_message_filter.h"
13 #include "media/audio/audio_output_ipc.h" 13 #include "media/audio/audio_output_ipc.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 namespace content { 16 namespace content {
17 namespace { 17 namespace {
18 18
19 const int kRenderFrameId = 2; 19 const int kRenderFrameId = 2;
20 const char kEmptyMatchedDeviceId[] = ""; 20 const char kEmptyMatchedDeviceId[] = "";
21 21
22 class MockAudioDelegate : public media::AudioOutputIPCDelegate { 22 class MockAudioDelegate : public media::AudioOutputIPCDelegate {
23 public: 23 public:
24 MockAudioDelegate() { 24 MockAudioDelegate() {
25 Reset(); 25 Reset();
26 } 26 }
27 ~MockAudioDelegate() override {
28 if (handle_.IsValid())
29 handle_.Close();
30 }
27 31
28 void OnError() override { error_received_ = true; } 32 void OnError() override { error_received_ = true; }
29 33
30 void OnDeviceAuthorized(media::OutputDeviceStatus device_status, 34 void OnDeviceAuthorized(media::OutputDeviceStatus device_status,
31 const media::AudioParameters& output_params, 35 const media::AudioParameters& output_params,
32 const std::string& matched_device_id) override { 36 const std::string& matched_device_id) override {
33 device_authorized_received_ = true; 37 device_authorized_received_ = true;
34 device_status_ = device_status; 38 device_status_ = device_status;
35 output_params_ = output_params; 39 output_params_ = output_params;
36 matched_device_id_ = matched_device_id; 40 matched_device_id_ = matched_device_id;
(...skipping 10 matching lines...) Expand all
47 void OnIPCClosed() override {} 51 void OnIPCClosed() override {}
48 52
49 void Reset() { 53 void Reset() {
50 error_received_ = false; 54 error_received_ = false;
51 55
52 device_authorized_received_ = false; 56 device_authorized_received_ = false;
53 output_params_ = media::AudioParameters(); 57 output_params_ = media::AudioParameters();
54 device_status_ = media::OUTPUT_DEVICE_STATUS_ERROR_INTERNAL; 58 device_status_ = media::OUTPUT_DEVICE_STATUS_ERROR_INTERNAL;
55 59
56 created_received_ = false; 60 created_received_ = false;
61 if (handle_.IsValid())
62 handle_.Close();
57 handle_ = base::SharedMemoryHandle(); 63 handle_ = base::SharedMemoryHandle();
58 length_ = 0; 64 length_ = 0;
59 65
60 volume_received_ = false; 66 volume_received_ = false;
61 volume_ = 0; 67 volume_ = 0;
62 } 68 }
63 69
64 bool error_received() { return error_received_; } 70 bool error_received() { return error_received_; }
65 71
66 bool device_authorized_received() { return device_authorized_received_; } 72 bool device_authorized_received() { return device_authorized_received_; }
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 191
186 ipc1->CloseStream(); 192 ipc1->CloseStream();
187 ipc2->CloseStream(); 193 ipc2->CloseStream();
188 EXPECT_EQ(static_cast<media::AudioOutputIPCDelegate*>(NULL), 194 EXPECT_EQ(static_cast<media::AudioOutputIPCDelegate*>(NULL),
189 filter->delegates_.Lookup(kStreamId1)); 195 filter->delegates_.Lookup(kStreamId1));
190 EXPECT_EQ(static_cast<media::AudioOutputIPCDelegate*>(NULL), 196 EXPECT_EQ(static_cast<media::AudioOutputIPCDelegate*>(NULL),
191 filter->delegates_.Lookup(kStreamId2)); 197 filter->delegates_.Lookup(kStreamId2));
192 } 198 }
193 199
194 } // namespace content 200 } // namespace content
OLDNEW
« no previous file with comments | « content/common/sandbox_mac_fontloading_unittest.mm ('k') | content/renderer/media/speech_recognition_audio_sink_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698