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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/BaseAudioContextTest.cpp

Issue 2867693004: Snapshot of all changes to get jumbo in blink and content.
Patch Set: Rebased again Created 3 years, 5 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 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 #include "modules/webaudio/BaseAudioContext.h" 5 #include "modules/webaudio/BaseAudioContext.h"
6 6
7 #include "bindings/core/v8/V8BindingForCore.h" 7 #include "bindings/core/v8/V8BindingForCore.h"
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/dom/UserGestureIndicator.h" 9 #include "core/dom/UserGestureIndicator.h"
10 #include "core/frame/FrameOwner.h" 10 #include "core/frame/FrameOwner.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 Frame* Parent() const override { return parent_.Get(); } 44 Frame* Parent() const override { return parent_.Get(); }
45 Frame* Top() const override { return parent_.Get(); } 45 Frame* Top() const override { return parent_.Get(); }
46 46
47 private: 47 private:
48 explicit MockCrossOriginLocalFrameClient(Frame* parent) : parent_(parent) {} 48 explicit MockCrossOriginLocalFrameClient(Frame* parent) : parent_(parent) {}
49 49
50 Member<Frame> parent_; 50 Member<Frame> parent_;
51 }; 51 };
52 52
53 class MockWebAudioDevice : public WebAudioDevice { 53 class MockWebAudioDeviceForBaseAudioContext : public WebAudioDevice {
54 public: 54 public:
55 explicit MockWebAudioDevice(double sample_rate, int frames_per_buffer) 55 explicit MockWebAudioDeviceForBaseAudioContext(double sample_rate,
56 int frames_per_buffer)
56 : sample_rate_(sample_rate), frames_per_buffer_(frames_per_buffer) {} 57 : sample_rate_(sample_rate), frames_per_buffer_(frames_per_buffer) {}
57 ~MockWebAudioDevice() override = default; 58 ~MockWebAudioDeviceForBaseAudioContext() override = default;
58 59
59 void Start() override {} 60 void Start() override {}
60 void Stop() override {} 61 void Stop() override {}
61 double SampleRate() override { return sample_rate_; } 62 double SampleRate() override { return sample_rate_; }
62 int FramesPerBuffer() override { return frames_per_buffer_; } 63 int FramesPerBuffer() override { return frames_per_buffer_; }
63 64
64 private: 65 private:
65 double sample_rate_; 66 double sample_rate_;
66 int frames_per_buffer_; 67 int frames_per_buffer_;
67 }; 68 };
68 69
69 class BaseAudioContextTestPlatform : public TestingPlatformSupport { 70 class BaseAudioContextTestPlatform : public TestingPlatformSupport {
70 public: 71 public:
71 std::unique_ptr<WebAudioDevice> CreateAudioDevice( 72 std::unique_ptr<WebAudioDevice> CreateAudioDevice(
72 unsigned number_of_input_channels, 73 unsigned number_of_input_channels,
73 unsigned number_of_channels, 74 unsigned number_of_channels,
74 const WebAudioLatencyHint& latency_hint, 75 const WebAudioLatencyHint& latency_hint,
75 WebAudioDevice::RenderCallback*, 76 WebAudioDevice::RenderCallback*,
76 const WebString& device_id, 77 const WebString& device_id,
77 const WebSecurityOrigin&) override { 78 const WebSecurityOrigin&) override {
78 return WTF::MakeUnique<MockWebAudioDevice>(AudioHardwareSampleRate(), 79 return WTF::MakeUnique<MockWebAudioDeviceForBaseAudioContext>(
79 AudioHardwareBufferSize()); 80 AudioHardwareSampleRate(), AudioHardwareBufferSize());
80 } 81 }
81 82
82 double AudioHardwareSampleRate() override { return 44100; } 83 double AudioHardwareSampleRate() override { return 44100; }
83 size_t AudioHardwareBufferSize() override { return 128; } 84 size_t AudioHardwareBufferSize() override { return 128; }
84 }; 85 };
85 86
86 } // anonymous namespace 87 } // anonymous namespace
87 88
88 class BaseAudioContextAutoplayTest 89 class BaseAudioContextAutoplayTest
89 : public ::testing::TestWithParam<AutoplayPolicy::Type> { 90 : public ::testing::TestWithParam<AutoplayPolicy::Type> {
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 733
733 INSTANTIATE_TEST_CASE_P( 734 INSTANTIATE_TEST_CASE_P(
734 BaseAudioContextAutoplayTest, 735 BaseAudioContextAutoplayTest,
735 BaseAudioContextAutoplayTest, 736 BaseAudioContextAutoplayTest,
736 ::testing::Values(AutoplayPolicy::Type::kNoUserGestureRequired, 737 ::testing::Values(AutoplayPolicy::Type::kNoUserGestureRequired,
737 AutoplayPolicy::Type::kUserGestureRequired, 738 AutoplayPolicy::Type::kUserGestureRequired,
738 AutoplayPolicy::Type::kUserGestureRequiredForCrossOrigin, 739 AutoplayPolicy::Type::kUserGestureRequiredForCrossOrigin,
739 AutoplayPolicy::Type::kDocumentUserActivationRequired)); 740 AutoplayPolicy::Type::kDocumentUserActivationRequired));
740 741
741 } // namespace blink 742 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/BUILD.gn ('k') | third_party/WebKit/Source/platform/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698