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

Side by Side Diff: services/data_decoder/image_decoder_impl_unittest.cc

Issue 2812063002: [scheduler] Remove WebThreadImplForUtilityThread from public API. (Closed)
Patch Set: Fix unittest compilation Created 3 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 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 <memory> 5 #include <memory>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "gin/array_buffer.h" 11 #include "gin/array_buffer.h"
12 #include "gin/public/isolate_holder.h" 12 #include "gin/public/isolate_holder.h"
13 #include "services/data_decoder/image_decoder_impl.h" 13 #include "services/data_decoder/image_decoder_impl.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 #include "third_party/WebKit/public/platform/scheduler/utility/webthread_impl_fo r_utility_thread.h" 15 #include "third_party/WebKit/public/platform/scheduler/child/webthread_base.h"
16 #include "third_party/WebKit/public/web/WebKit.h" 16 #include "third_party/WebKit/public/web/WebKit.h"
17 #include "third_party/skia/include/core/SkBitmap.h" 17 #include "third_party/skia/include/core/SkBitmap.h"
18 #include "ui/gfx/codec/jpeg_codec.h" 18 #include "ui/gfx/codec/jpeg_codec.h"
19 19
20 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) 20 #if defined(V8_USE_EXTERNAL_STARTUP_DATA)
21 #include "gin/v8_initializer.h" 21 #include "gin/v8_initializer.h"
22 #endif 22 #endif
23 23
24 namespace data_decoder { 24 namespace data_decoder {
25 25
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 ImageDecoderImpl* decoder_; 65 ImageDecoderImpl* decoder_;
66 SkBitmap bitmap_; 66 SkBitmap bitmap_;
67 }; 67 };
68 68
69 // We need to ensure that Blink and V8 are initialized in order to use content's 69 // We need to ensure that Blink and V8 are initialized in order to use content's
70 // image decoding call. 70 // image decoding call.
71 class BlinkInitializer : public blink::Platform { 71 class BlinkInitializer : public blink::Platform {
72 public: 72 public:
73 BlinkInitializer() 73 BlinkInitializer()
74 : main_thread_(new blink::scheduler::WebThreadImplForUtilityThread()) { 74 : main_thread_(
75 blink::scheduler::WebThreadBase::InitializeUtilityThread()) {
75 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) 76 #if defined(V8_USE_EXTERNAL_STARTUP_DATA)
76 gin::V8Initializer::LoadV8Snapshot(); 77 gin::V8Initializer::LoadV8Snapshot();
77 gin::V8Initializer::LoadV8Natives(); 78 gin::V8Initializer::LoadV8Natives();
78 #endif 79 #endif
79 80
80 blink::Initialize(this); 81 blink::Initialize(this);
81 } 82 }
82 83
83 ~BlinkInitializer() override {} 84 ~BlinkInitializer() override {}
84 85
85 blink::WebThread* CurrentThread() override { return main_thread_.get(); } 86 blink::WebThread* CurrentThread() override { return main_thread_.get(); }
86 87
87 private: 88 private:
88 std::unique_ptr<blink::scheduler::WebThreadImplForUtilityThread> main_thread_; 89 std::unique_ptr<blink::scheduler::WebThreadBase> main_thread_;
89 90
90 DISALLOW_COPY_AND_ASSIGN(BlinkInitializer); 91 DISALLOW_COPY_AND_ASSIGN(BlinkInitializer);
91 }; 92 };
92 93
93 base::LazyInstance<BlinkInitializer>::Leaky g_blink_initializer = 94 base::LazyInstance<BlinkInitializer>::Leaky g_blink_initializer =
94 LAZY_INSTANCE_INITIALIZER; 95 LAZY_INSTANCE_INITIALIZER;
95 96
96 class ImageDecoderImplTest : public testing::Test { 97 class ImageDecoderImplTest : public testing::Test {
97 public: 98 public:
98 ImageDecoderImplTest() : decoder_(nullptr) {} 99 ImageDecoderImplTest() : decoder_(nullptr) {}
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 const char kRandomData[] = "u gycfy7xdjkhfgui bdui "; 155 const char kRandomData[] = "u gycfy7xdjkhfgui bdui ";
155 std::vector<unsigned char> jpg(kRandomData, 156 std::vector<unsigned char> jpg(kRandomData,
156 kRandomData + sizeof(kRandomData)); 157 kRandomData + sizeof(kRandomData));
157 158
158 Request request(decoder()); 159 Request request(decoder());
159 request.DecodeImage(jpg, false); 160 request.DecodeImage(jpg, false);
160 EXPECT_TRUE(request.bitmap().isNull()); 161 EXPECT_TRUE(request.bitmap().isNull());
161 } 162 }
162 163
163 } // namespace data_decoder 164 } // namespace data_decoder
OLDNEW
« no previous file with comments | « content/utility/utility_blink_platform_impl.cc ('k') | third_party/WebKit/Source/platform/scheduler/child/webthread_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698