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

Unified Diff: content/renderer/media/mock_audio_device_factory.cc

Issue 1834323002: MediaStream audio: Refactor 3 separate "glue" implementations into one. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reworked unit tests around structural changes, and added exhaustive media_stream_audio_unittest.cc. Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/mock_audio_device_factory.cc
diff --git a/content/renderer/dom_storage/local_storage_area.h b/content/renderer/media/mock_audio_device_factory.cc
similarity index 15%
copy from content/renderer/dom_storage/local_storage_area.h
copy to content/renderer/media/mock_audio_device_factory.cc
index 312521545139d6f9d6fff1ce207aa78bbddfd4a1..5d29fde6559578d4370158d8d6a065839f50c287 100644
--- a/content/renderer/dom_storage/local_storage_area.h
+++ b/content/renderer/media/mock_audio_device_factory.cc
@@ -2,47 +2,59 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_AREA_H_
-#define CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_AREA_H_
-
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "content/renderer/dom_storage/local_storage_cached_area.h"
-#include "third_party/WebKit/public/platform/WebStorageArea.h"
+#include "content/renderer/media/mock_audio_device_factory.h"
namespace content {
-// There could be n instances of this class for the same origin in a renderer
-// process. It delegates to the one LocalStorageCachedArea instance in a process
-// for a given origin.
-class LocalStorageArea : public blink::WebStorageArea {
- public:
- explicit LocalStorageArea(scoped_refptr<LocalStorageCachedArea> cached_area);
- ~LocalStorageArea() override;
-
- // blink::WebStorageArea:
- unsigned length() override;
- blink::WebString key(unsigned index) override;
- blink::WebString getItem(const blink::WebString& key) override;
- void setItem(const blink::WebString& key,
- const blink::WebString& value,
- const blink::WebURL& page_url,
- WebStorageArea::Result& result) override;
- void removeItem(const blink::WebString& key,
- const blink::WebURL& page_url) override;
- void clear(const blink::WebURL& url) override;
-
- const std::string& id() const { return id_; }
-
- private:
- scoped_refptr<LocalStorageCachedArea> cached_area_;
- // A globally unique identifier for this storage area. It's used to pass the
- // source storage area, if any, in mutation events.
- std::string id_;
-
- DISALLOW_COPY_AND_ASSIGN(LocalStorageArea);
-};
+MockCapturerSource::MockCapturerSource() {}
+
+MockCapturerSource::~MockCapturerSource() {}
+
+void MockCapturerSource::SetVolume(double volume) {}
+
+MockAudioDeviceFactory::MockAudioDeviceFactory()
+ : AudioDeviceFactory(), mock_capturer_source_(new MockCapturerSource()),
+ did_create_once_(false) {}
+
+MockAudioDeviceFactory::~MockAudioDeviceFactory() {}
+
+scoped_refptr<media::AudioRendererSink>
+MockAudioDeviceFactory::CreateFinalAudioRendererSink(
+ int render_frame_id,
+ int sesssion_id,
+ const std::string& device_id,
+ const url::Origin& security_origin) {
+ NOTIMPLEMENTED();
o1ka 2016/05/04 08:49:24 You can just mock them.
miu 2016/05/04 22:10:09 Done.
+ return nullptr;
+}
+
+scoped_refptr<media::AudioRendererSink>
+MockAudioDeviceFactory::CreateAudioRendererSink(
+ SourceType source_type,
+ int render_frame_id,
+ int sesssion_id,
+ const std::string& device_id,
+ const url::Origin& security_origin) {
+ NOTIMPLEMENTED();
+ return nullptr;
+}
+
+scoped_refptr<media::SwitchableAudioRendererSink>
+MockAudioDeviceFactory::CreateSwitchableAudioRendererSink(
+ SourceType source_type,
+ int render_frame_id,
+ int sesssion_id,
+ const std::string& device_id,
+ const url::Origin& security_origin) {
+ NOTIMPLEMENTED();
+ return nullptr;
+}
+
+scoped_refptr<media::AudioCapturerSource>
+MockAudioDeviceFactory::CreateAudioCapturerSource(int render_frame_id) {
+ CHECK(!did_create_once_);
+ did_create_once_ = true;
+ return scoped_refptr<media::AudioCapturerSource>(mock_capturer_source_);
+}
} // namespace content
-
-#endif // CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_AREA_H_

Powered by Google App Engine
This is Rietveld 408576698