OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_AREA_H_ | 5 #include "content/renderer/media/mock_audio_device_factory.h" |
6 #define CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_AREA_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "base/memory/ref_counted.h" | |
10 #include "content/renderer/dom_storage/local_storage_cached_area.h" | |
11 #include "third_party/WebKit/public/platform/WebStorageArea.h" | |
12 | 6 |
13 namespace content { | 7 namespace content { |
14 | 8 |
15 // There could be n instances of this class for the same origin in a renderer | 9 MockCapturerSource::MockCapturerSource() {} |
16 // process. It delegates to the one LocalStorageCachedArea instance in a process | |
17 // for a given origin. | |
18 class LocalStorageArea : public blink::WebStorageArea { | |
19 public: | |
20 explicit LocalStorageArea(scoped_refptr<LocalStorageCachedArea> cached_area); | |
21 ~LocalStorageArea() override; | |
22 | 10 |
23 // blink::WebStorageArea: | 11 MockCapturerSource::~MockCapturerSource() {} |
24 unsigned length() override; | |
25 blink::WebString key(unsigned index) override; | |
26 blink::WebString getItem(const blink::WebString& key) override; | |
27 void setItem(const blink::WebString& key, | |
28 const blink::WebString& value, | |
29 const blink::WebURL& page_url, | |
30 WebStorageArea::Result& result) override; | |
31 void removeItem(const blink::WebString& key, | |
32 const blink::WebURL& page_url) override; | |
33 void clear(const blink::WebURL& url) override; | |
34 | 12 |
35 const std::string& id() const { return id_; } | 13 void MockCapturerSource::SetVolume(double volume) {} |
36 | 14 |
37 private: | 15 MockAudioDeviceFactory::MockAudioDeviceFactory() |
38 scoped_refptr<LocalStorageCachedArea> cached_area_; | 16 : AudioDeviceFactory(), mock_capturer_source_(new MockCapturerSource()), |
39 // A globally unique identifier for this storage area. It's used to pass the | 17 did_create_once_(false) {} |
40 // source storage area, if any, in mutation events. | |
41 std::string id_; | |
42 | 18 |
43 DISALLOW_COPY_AND_ASSIGN(LocalStorageArea); | 19 MockAudioDeviceFactory::~MockAudioDeviceFactory() {} |
44 }; | 20 |
21 scoped_refptr<media::AudioRendererSink> | |
22 MockAudioDeviceFactory::CreateFinalAudioRendererSink( | |
23 int render_frame_id, | |
24 int sesssion_id, | |
25 const std::string& device_id, | |
26 const url::Origin& security_origin) { | |
27 NOTIMPLEMENTED(); | |
o1ka
2016/05/04 08:49:24
You can just mock them.
miu
2016/05/04 22:10:09
Done.
| |
28 return nullptr; | |
29 } | |
30 | |
31 scoped_refptr<media::AudioRendererSink> | |
32 MockAudioDeviceFactory::CreateAudioRendererSink( | |
33 SourceType source_type, | |
34 int render_frame_id, | |
35 int sesssion_id, | |
36 const std::string& device_id, | |
37 const url::Origin& security_origin) { | |
38 NOTIMPLEMENTED(); | |
39 return nullptr; | |
40 } | |
41 | |
42 scoped_refptr<media::SwitchableAudioRendererSink> | |
43 MockAudioDeviceFactory::CreateSwitchableAudioRendererSink( | |
44 SourceType source_type, | |
45 int render_frame_id, | |
46 int sesssion_id, | |
47 const std::string& device_id, | |
48 const url::Origin& security_origin) { | |
49 NOTIMPLEMENTED(); | |
50 return nullptr; | |
51 } | |
52 | |
53 scoped_refptr<media::AudioCapturerSource> | |
54 MockAudioDeviceFactory::CreateAudioCapturerSource(int render_frame_id) { | |
55 CHECK(!did_create_once_); | |
56 did_create_once_ = true; | |
57 return scoped_refptr<media::AudioCapturerSource>(mock_capturer_source_); | |
58 } | |
45 | 59 |
46 } // namespace content | 60 } // namespace content |
47 | |
48 #endif // CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_AREA_H_ | |
OLD | NEW |