OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
10 #include "base/test/launcher/unit_test_launcher.h" | 10 #include "base/test/launcher/unit_test_launcher.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 bool isCurrentThread() const override { return true; } | 56 bool isCurrentThread() const override { return true; } |
57 | 57 |
58 blink::PlatformThreadId threadId() const override { return 17; } | 58 blink::PlatformThreadId threadId() const override { return 17; } |
59 | 59 |
60 blink::WebScheduler* scheduler() const override { | 60 blink::WebScheduler* scheduler() const override { |
61 return web_scheduler_.get(); | 61 return web_scheduler_.get(); |
62 } | 62 } |
63 | 63 |
64 private: | 64 private: |
65 scoped_refptr<scheduler::SchedulerTqmDelegate> task_runner_delegate_; | 65 scoped_refptr<scheduler::SchedulerTqmDelegate> task_runner_delegate_; |
66 scoped_ptr<scheduler::RendererSchedulerImpl> scheduler_; | 66 std::unique_ptr<scheduler::RendererSchedulerImpl> scheduler_; |
67 scoped_ptr<blink::WebScheduler> web_scheduler_; | 67 std::unique_ptr<blink::WebScheduler> web_scheduler_; |
68 scoped_ptr<blink::WebTaskRunner> web_task_runner_; | 68 std::unique_ptr<blink::WebTaskRunner> web_task_runner_; |
69 }; | 69 }; |
70 | 70 |
71 class TestBlinkPlatformSupport : NON_EXPORTED_BASE(public blink::Platform) { | 71 class TestBlinkPlatformSupport : NON_EXPORTED_BASE(public blink::Platform) { |
72 public: | 72 public: |
73 ~TestBlinkPlatformSupport() override; | 73 ~TestBlinkPlatformSupport() override; |
74 | 74 |
75 blink::WebThread* currentThread() override { return &m_currentThread; } | 75 blink::WebThread* currentThread() override { return &m_currentThread; } |
76 void registerMemoryDumpProvider(blink::WebMemoryDumpProvider*, | 76 void registerMemoryDumpProvider(blink::WebMemoryDumpProvider*, |
77 const char* name) override {} | 77 const char* name) override {} |
78 void unregisterMemoryDumpProvider(blink::WebMemoryDumpProvider*) override {} | 78 void unregisterMemoryDumpProvider(blink::WebMemoryDumpProvider*) override {} |
79 | 79 |
80 private: | 80 private: |
81 CurrentThreadMock m_currentThread; | 81 CurrentThreadMock m_currentThread; |
82 }; | 82 }; |
83 | 83 |
84 TestBlinkPlatformSupport::~TestBlinkPlatformSupport() {} | 84 TestBlinkPlatformSupport::~TestBlinkPlatformSupport() {} |
85 | 85 |
86 class BlinkMediaTestSuite : public base::TestSuite { | 86 class BlinkMediaTestSuite : public base::TestSuite { |
87 public: | 87 public: |
88 BlinkMediaTestSuite(int argc, char** argv); | 88 BlinkMediaTestSuite(int argc, char** argv); |
89 ~BlinkMediaTestSuite() override; | 89 ~BlinkMediaTestSuite() override; |
90 | 90 |
91 protected: | 91 protected: |
92 void Initialize() override; | 92 void Initialize() override; |
93 | 93 |
94 private: | 94 private: |
95 scoped_ptr<TestBlinkPlatformSupport> blink_platform_support_; | 95 std::unique_ptr<TestBlinkPlatformSupport> blink_platform_support_; |
96 }; | 96 }; |
97 | 97 |
98 BlinkMediaTestSuite::BlinkMediaTestSuite(int argc, char** argv) | 98 BlinkMediaTestSuite::BlinkMediaTestSuite(int argc, char** argv) |
99 : TestSuite(argc, argv), | 99 : TestSuite(argc, argv), |
100 blink_platform_support_(new TestBlinkPlatformSupport()) { | 100 blink_platform_support_(new TestBlinkPlatformSupport()) { |
101 } | 101 } |
102 | 102 |
103 BlinkMediaTestSuite::~BlinkMediaTestSuite() {} | 103 BlinkMediaTestSuite::~BlinkMediaTestSuite() {} |
104 | 104 |
105 void BlinkMediaTestSuite::Initialize() { | 105 void BlinkMediaTestSuite::Initialize() { |
(...skipping 13 matching lines...) Expand all Loading... |
119 media::InitializeMediaLibrary(); | 119 media::InitializeMediaLibrary(); |
120 | 120 |
121 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 121 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
122 gin::V8Initializer::LoadV8Snapshot(); | 122 gin::V8Initializer::LoadV8Snapshot(); |
123 gin::V8Initializer::LoadV8Natives(); | 123 gin::V8Initializer::LoadV8Natives(); |
124 #endif | 124 #endif |
125 | 125 |
126 // Dummy task runner is initialized here because the blink::initialize creates | 126 // Dummy task runner is initialized here because the blink::initialize creates |
127 // IsolateHolder which needs the current task runner handle. There should be | 127 // IsolateHolder which needs the current task runner handle. There should be |
128 // no task posted to this task runner. | 128 // no task posted to this task runner. |
129 scoped_ptr<base::MessageLoop> message_loop; | 129 std::unique_ptr<base::MessageLoop> message_loop; |
130 if (!base::MessageLoop::current()) | 130 if (!base::MessageLoop::current()) |
131 message_loop.reset(new base::MessageLoop()); | 131 message_loop.reset(new base::MessageLoop()); |
132 blink::initialize(blink_platform_support_.get()); | 132 blink::initialize(blink_platform_support_.get()); |
133 } | 133 } |
134 | 134 |
135 int main(int argc, char** argv) { | 135 int main(int argc, char** argv) { |
136 BlinkMediaTestSuite test_suite(argc, argv); | 136 BlinkMediaTestSuite test_suite(argc, argv); |
137 | 137 |
138 return base::LaunchUnitTests( | 138 return base::LaunchUnitTests( |
139 argc, argv, base::Bind(&BlinkMediaTestSuite::Run, | 139 argc, argv, base::Bind(&BlinkMediaTestSuite::Run, |
140 base::Unretained(&test_suite))); | 140 base::Unretained(&test_suite))); |
141 } | 141 } |
OLD | NEW |