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 "cc/resources/ui_resource_bitmap.h" | 5 #include "cc/resources/ui_resource_bitmap.h" |
6 #include "cc/test/fake_layer_tree_host_client.h" | 6 #include "cc/test/fake_layer_tree_host_client.h" |
7 #include "cc/test/test_task_graph_runner.h" | 7 #include "cc/test/test_task_graph_runner.h" |
8 #include "cc/trees/layer_tree_host.h" | 8 #include "cc/trees/layer_tree_host.h" |
9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 using ::testing::SaveArg; | 27 using ::testing::SaveArg; |
28 using ::testing::SetArrayArgument; | 28 using ::testing::SetArrayArgument; |
29 using ::testing::SetArgPointee; | 29 using ::testing::SetArgPointee; |
30 using ::testing::StrEq; | 30 using ::testing::StrEq; |
31 using ::testing::StrictMock; | 31 using ::testing::StrictMock; |
32 | 32 |
33 namespace ui { | 33 namespace ui { |
34 | 34 |
35 class TestResourceManagerImpl : public ResourceManagerImpl { | 35 class TestResourceManagerImpl : public ResourceManagerImpl { |
36 public: | 36 public: |
37 TestResourceManagerImpl() {} | 37 TestResourceManagerImpl() |
| 38 : ResourceManagerImpl(base::android::GetApplicationContext()) {} |
| 39 |
38 ~TestResourceManagerImpl() override {} | 40 ~TestResourceManagerImpl() override {} |
39 | 41 |
40 void SetResourceAsLoaded(AndroidResourceType res_type, int res_id) { | 42 void SetResourceAsLoaded(AndroidResourceType res_type, int res_id) { |
41 SkBitmap small_bitmap; | 43 SkBitmap small_bitmap; |
42 SkCanvas canvas(small_bitmap); | 44 SkCanvas canvas(small_bitmap); |
43 small_bitmap.allocPixels( | 45 small_bitmap.allocPixels( |
44 SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType)); | 46 SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType)); |
45 canvas.drawColor(SK_ColorWHITE); | 47 canvas.drawColor(SK_ColorWHITE); |
46 small_bitmap.setImmutable(); | 48 small_bitmap.setImmutable(); |
47 | 49 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 const cc::UIResourceId kResourceId = 99; | 125 const cc::UIResourceId kResourceId = 99; |
124 PreloadResource(kTestResourceType); | 126 PreloadResource(kTestResourceType); |
125 EXPECT_CALL(*host_.get(), CreateUIResource(_)) | 127 EXPECT_CALL(*host_.get(), CreateUIResource(_)) |
126 .WillOnce(Return(kResourceId)) | 128 .WillOnce(Return(kResourceId)) |
127 .RetiresOnSaturation(); | 129 .RetiresOnSaturation(); |
128 SetResourceAsLoaded(kTestResourceType); | 130 SetResourceAsLoaded(kTestResourceType); |
129 EXPECT_EQ(kResourceId, GetUIResourceId(kTestResourceType)); | 131 EXPECT_EQ(kResourceId, GetUIResourceId(kTestResourceType)); |
130 } | 132 } |
131 | 133 |
132 } // namespace ui | 134 } // namespace ui |
OLD | NEW |