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

Side by Side Diff: ui/android/resources/resource_manager_impl_unittest.cc

Issue 2746483003: ui/android: Fix Resource meta-data sharing with ResourceManager. (Closed)
Patch Set: jni Created 3 years, 9 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
« no previous file with comments | « ui/android/resources/resource_manager_impl.cc ('k') | ui/android/ui_android_jni_registrar.cc » ('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 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/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/trace_event/memory_dump_manager.h" 10 #include "base/trace_event/memory_dump_manager.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 void SetResourceAsLoaded(AndroidResourceType res_type, int res_id) { 50 void SetResourceAsLoaded(AndroidResourceType res_type, int res_id) {
51 SkBitmap small_bitmap; 51 SkBitmap small_bitmap;
52 SkCanvas canvas(small_bitmap); 52 SkCanvas canvas(small_bitmap);
53 small_bitmap.allocPixels( 53 small_bitmap.allocPixels(
54 SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType)); 54 SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));
55 canvas.drawColor(SK_ColorWHITE); 55 canvas.drawColor(SK_ColorWHITE);
56 small_bitmap.setImmutable(); 56 small_bitmap.setImmutable();
57 57
58 OnResourceReady(nullptr, nullptr, res_type, res_id, 58 OnResourceReady(nullptr, nullptr, res_type, res_id,
59 gfx::ConvertToJavaBitmap(&small_bitmap), 0, 0, 0, 0, 0, 0, 59 gfx::ConvertToJavaBitmap(&small_bitmap),
60 0, 0); 60 reinterpret_cast<intptr_t>(new Resource()));
61 } 61 }
62 62
63 protected: 63 protected:
64 void PreloadResourceFromJava(AndroidResourceType res_type, 64 void PreloadResourceFromJava(AndroidResourceType res_type,
65 int res_id) override {} 65 int res_id) override {}
66 66
67 void RequestResourceFromJava(AndroidResourceType res_type, 67 void RequestResourceFromJava(AndroidResourceType res_type,
68 int res_id) override { 68 int res_id) override {
69 SetResourceAsLoaded(res_type, res_id); 69 SetResourceAsLoaded(res_type, res_id);
70 } 70 }
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 ->system_allocator_pool_name(); 195 ->system_allocator_pool_name();
196 size_t expected_dump_count = system_allocator_pool_name ? 2 : 1; 196 size_t expected_dump_count = system_allocator_pool_name ? 2 : 1;
197 EXPECT_EQ(expected_dump_count, allocator_dumps.size()); 197 EXPECT_EQ(expected_dump_count, allocator_dumps.size());
198 for (const auto& dump : allocator_dumps) { 198 for (const auto& dump : allocator_dumps) {
199 ASSERT_TRUE(dump.first.find("ui/resource_manager") == 0 || 199 ASSERT_TRUE(dump.first.find("ui/resource_manager") == 0 ||
200 dump.first.find(system_allocator_pool_name) == 0); 200 dump.first.find(system_allocator_pool_name) == 0);
201 } 201 }
202 } 202 }
203 203
204 } // namespace ui 204 } // namespace ui
OLDNEW
« no previous file with comments | « ui/android/resources/resource_manager_impl.cc ('k') | ui/android/ui_android_jni_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698