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

Side by Side Diff: chrome/utility/image_decoder_impl_unittest.cc

Issue 2483013002: Mojo C++ bindings: Remove more use_new_wrapper_types=false. (Closed)
Patch Set: . Created 4 years, 1 month 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
« no previous file with comments | « chrome/utility/image_decoder_impl.cc ('k') | components/contextual_search/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/utility/image_decoder_impl.h" 5 #include "chrome/utility/image_decoder_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "ipc/ipc_channel.h" 10 #include "ipc/ipc_channel.h"
(...skipping 23 matching lines...) Expand all
34 } 34 }
35 return true; 35 return true;
36 } 36 }
37 37
38 class Request { 38 class Request {
39 public: 39 public:
40 explicit Request(ImageDecoderImpl* decoder) : decoder_(decoder) {} 40 explicit Request(ImageDecoderImpl* decoder) : decoder_(decoder) {}
41 41
42 void DecodeImage(const std::vector<unsigned char>& image, bool shrink) { 42 void DecodeImage(const std::vector<unsigned char>& image, bool shrink) {
43 decoder_->DecodeImage( 43 decoder_->DecodeImage(
44 mojo::Array<uint8_t>::From(image), ImageCodec::DEFAULT, 44 image, ImageCodec::DEFAULT, shrink,
45 shrink, base::Bind(&Request::OnRequestDone, base::Unretained(this))); 45 base::Bind(&Request::OnRequestDone, base::Unretained(this)));
46 } 46 }
47 47
48 const SkBitmap& bitmap() const { return bitmap_; } 48 const SkBitmap& bitmap() const { return bitmap_; }
49 49
50 private: 50 private:
51 void OnRequestDone(const SkBitmap& result_image) { bitmap_ = result_image; } 51 void OnRequestDone(const SkBitmap& result_image) { bitmap_ = result_image; }
52 52
53 ImageDecoderImpl* decoder_; 53 ImageDecoderImpl* decoder_;
54 SkBitmap bitmap_; 54 SkBitmap bitmap_;
55 }; 55 };
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 const char kRandomData[] = "u gycfy7xdjkhfgui bdui "; 109 const char kRandomData[] = "u gycfy7xdjkhfgui bdui ";
110 std::vector<unsigned char> jpg(kRandomData, 110 std::vector<unsigned char> jpg(kRandomData,
111 kRandomData + sizeof(kRandomData)); 111 kRandomData + sizeof(kRandomData));
112 112
113 Request request(&decoder); 113 Request request(&decoder);
114 request.DecodeImage(jpg, false); 114 request.DecodeImage(jpg, false);
115 EXPECT_TRUE(request.bitmap().isNull()); 115 EXPECT_TRUE(request.bitmap().isNull());
116 } 116 }
117 117
118 } // namespace mojom 118 } // namespace mojom
OLDNEW
« no previous file with comments | « chrome/utility/image_decoder_impl.cc ('k') | components/contextual_search/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698