| 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 "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 #include "third_party/skia/include/core/SkBitmap.h" | 7 #include "third_party/skia/include/core/SkBitmap.h" |
| 8 #include "third_party/skia/include/core/SkCanvas.h" | 8 #include "third_party/skia/include/core/SkCanvas.h" |
| 9 #include "ui/android/resources/resource_manager_impl.h" | 9 #include "ui/android/resources/resource_manager_impl.h" |
| 10 #include "ui/android/resources/system_ui_resource_type.h" | 10 #include "ui/android/resources/system_ui_resource_type.h" |
| 11 #include "ui/android/resources/ui_resource_client_android.h" | 11 #include "ui/android/resources/ui_resource_client_android.h" |
| 12 #include "ui/android/resources/ui_resource_provider.h" | 12 #include "ui/android/resources/ui_resource_provider.h" |
| 13 #include "ui/gfx/android/java_bitmap.h" | 13 #include "ui/gfx/android/java_bitmap.h" |
| 14 | 14 |
| 15 namespace ui { | 15 namespace ui { |
| 16 | 16 |
| 17 class TestResourceManagerImpl : public ResourceManagerImpl { | 17 class TestResourceManagerImpl : public ResourceManagerImpl { |
| 18 public: | 18 public: |
| 19 explicit TestResourceManagerImpl(UIResourceProvider* provider) | 19 explicit TestResourceManagerImpl(UIResourceProvider* provider) |
| 20 : ResourceManagerImpl(provider) {} | 20 : ResourceManagerImpl(provider, base::android::GetApplicationContext()) {} |
| 21 | 21 |
| 22 ~TestResourceManagerImpl() override {} | 22 ~TestResourceManagerImpl() override {} |
| 23 | 23 |
| 24 void SetResourceAsLoaded(AndroidResourceType res_type, int res_id) { | 24 void SetResourceAsLoaded(AndroidResourceType res_type, int res_id) { |
| 25 SkBitmap small_bitmap; | 25 SkBitmap small_bitmap; |
| 26 SkCanvas canvas(small_bitmap); | 26 SkCanvas canvas(small_bitmap); |
| 27 small_bitmap.allocPixels( | 27 small_bitmap.allocPixels( |
| 28 SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType)); | 28 SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType)); |
| 29 canvas.drawColor(SK_ColorWHITE); | 29 canvas.drawColor(SK_ColorWHITE); |
| 30 small_bitmap.setImmutable(); | 30 small_bitmap.setImmutable(); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 152 |
| 153 TEST_F(ResourceManagerTest, ResetLayerTreeHost) { | 153 TEST_F(ResourceManagerTest, ResetLayerTreeHost) { |
| 154 EXPECT_NE(0, GetUIResourceId(kTestResourceType)); | 154 EXPECT_NE(0, GetUIResourceId(kTestResourceType)); |
| 155 LayerTreeHostCleared(); | 155 LayerTreeHostCleared(); |
| 156 EXPECT_EQ(0, GetUIResourceId(kTestResourceType)); | 156 EXPECT_EQ(0, GetUIResourceId(kTestResourceType)); |
| 157 LayerTreeHostReturned(); | 157 LayerTreeHostReturned(); |
| 158 EXPECT_NE(0, GetUIResourceId(kTestResourceType)); | 158 EXPECT_NE(0, GetUIResourceId(kTestResourceType)); |
| 159 } | 159 } |
| 160 | 160 |
| 161 } // namespace ui | 161 } // namespace ui |
| OLD | NEW |