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

Side by Side Diff: content/browser/android/system_ui_resource_manager_impl_unittest.cc

Issue 629183002: Replacing the OVERRIDE with override and FINAL with final in content/browser/android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolving Error in android Created 6 years, 2 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 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 "content/browser/android/system_ui_resource_manager_impl.h" 6 #include "content/browser/android/system_ui_resource_manager_impl.h"
7 #include "content/public/browser/android/ui_resource_client_android.h" 7 #include "content/public/browser/android/ui_resource_client_android.h"
8 #include "content/public/browser/android/ui_resource_provider.h" 8 #include "content/public/browser/android/ui_resource_provider.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/skia/include/core/SkBitmap.h" 10 #include "third_party/skia/include/core/SkBitmap.h"
11 #include "third_party/skia/include/core/SkCanvas.h" 11 #include "third_party/skia/include/core/SkCanvas.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 class TestSystemUIResourceManagerImpl 15 class TestSystemUIResourceManagerImpl
16 : public content::SystemUIResourceManagerImpl { 16 : public content::SystemUIResourceManagerImpl {
17 public: 17 public:
18 TestSystemUIResourceManagerImpl(content::UIResourceProvider* provider) 18 TestSystemUIResourceManagerImpl(content::UIResourceProvider* provider)
19 : SystemUIResourceManagerImpl(provider) {} 19 : SystemUIResourceManagerImpl(provider) {}
20 20
21 virtual ~TestSystemUIResourceManagerImpl() {} 21 virtual ~TestSystemUIResourceManagerImpl() {}
22 22
23 virtual void BuildResource( 23 virtual void BuildResource(
24 ui::SystemUIResourceManager::ResourceType type) OVERRIDE {} 24 ui::SystemUIResourceManager::ResourceType type) override {}
25 25
26 void SetResourceAsLoaded(ui::SystemUIResourceManager::ResourceType type) { 26 void SetResourceAsLoaded(ui::SystemUIResourceManager::ResourceType type) {
27 SkBitmap small_bitmap; 27 SkBitmap small_bitmap;
28 SkCanvas canvas(small_bitmap); 28 SkCanvas canvas(small_bitmap);
29 small_bitmap.allocPixels( 29 small_bitmap.allocPixels(
30 SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType)); 30 SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));
31 canvas.drawColor(SK_ColorWHITE); 31 canvas.drawColor(SK_ColorWHITE);
32 small_bitmap.setImmutable(); 32 small_bitmap.setImmutable();
33 OnFinishedLoadBitmap(type, &small_bitmap); 33 OnFinishedLoadBitmap(type, &small_bitmap);
34 } 34 }
35 }; 35 };
36 36
37 namespace { 37 namespace {
38 38
39 const ui::SystemUIResourceManager::ResourceType TEST_RESOURCE_TYPE = 39 const ui::SystemUIResourceManager::ResourceType TEST_RESOURCE_TYPE =
40 ui::SystemUIResourceManager::OVERSCROLL_GLOW; 40 ui::SystemUIResourceManager::OVERSCROLL_GLOW;
41 41
42 class MockUIResourceProvider : public content::UIResourceProvider { 42 class MockUIResourceProvider : public content::UIResourceProvider {
43 public: 43 public:
44 MockUIResourceProvider() 44 MockUIResourceProvider()
45 : next_ui_resource_id_(1), 45 : next_ui_resource_id_(1),
46 has_layer_tree_host_(true), 46 has_layer_tree_host_(true),
47 system_ui_resource_manager_(this) {} 47 system_ui_resource_manager_(this) {}
48 48
49 virtual ~MockUIResourceProvider() {} 49 virtual ~MockUIResourceProvider() {}
50 50
51 virtual cc::UIResourceId CreateUIResource( 51 virtual cc::UIResourceId CreateUIResource(
52 content::UIResourceClientAndroid* client) OVERRIDE { 52 content::UIResourceClientAndroid* client) override {
53 if (!has_layer_tree_host_) 53 if (!has_layer_tree_host_)
54 return 0; 54 return 0;
55 cc::UIResourceId id = next_ui_resource_id_++; 55 cc::UIResourceId id = next_ui_resource_id_++;
56 client->GetBitmap(id, false); 56 client->GetBitmap(id, false);
57 ui_resource_client_map_[id] = client; 57 ui_resource_client_map_[id] = client;
58 return id; 58 return id;
59 } 59 }
60 60
61 virtual void DeleteUIResource(cc::UIResourceId id) OVERRIDE { 61 virtual void DeleteUIResource(cc::UIResourceId id) override {
62 CHECK(has_layer_tree_host_); 62 CHECK(has_layer_tree_host_);
63 ui_resource_client_map_.erase(id); 63 ui_resource_client_map_.erase(id);
64 } 64 }
65 65
66 virtual bool SupportsETC1NonPowerOfTwo() const OVERRIDE { return true; } 66 virtual bool SupportsETC1NonPowerOfTwo() const override { return true; }
67 67
68 void LayerTreeHostCleared() { 68 void LayerTreeHostCleared() {
69 has_layer_tree_host_ = false; 69 has_layer_tree_host_ = false;
70 UIResourceClientMap client_map = ui_resource_client_map_; 70 UIResourceClientMap client_map = ui_resource_client_map_;
71 ui_resource_client_map_.clear(); 71 ui_resource_client_map_.clear();
72 for (UIResourceClientMap::iterator iter = client_map.begin(); 72 for (UIResourceClientMap::iterator iter = client_map.begin();
73 iter != client_map.end(); 73 iter != client_map.end();
74 iter++) { 74 iter++) {
75 iter->second->UIResourceIsInvalid(); 75 iter->second->UIResourceIsInvalid();
76 } 76 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 SetResourceAsLoaded(TEST_RESOURCE_TYPE); 161 SetResourceAsLoaded(TEST_RESOURCE_TYPE);
162 EXPECT_NE(0, GetUIResourceId(TEST_RESOURCE_TYPE)); 162 EXPECT_NE(0, GetUIResourceId(TEST_RESOURCE_TYPE));
163 LayerTreeHostCleared(); 163 LayerTreeHostCleared();
164 EXPECT_EQ(0, GetUIResourceId(TEST_RESOURCE_TYPE)); 164 EXPECT_EQ(0, GetUIResourceId(TEST_RESOURCE_TYPE));
165 LayerTreeHostReturned(); 165 LayerTreeHostReturned();
166 EXPECT_NE(0, GetUIResourceId(TEST_RESOURCE_TYPE)); 166 EXPECT_NE(0, GetUIResourceId(TEST_RESOURCE_TYPE));
167 } 167 }
168 168
169 } // namespace content 169 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/system_ui_resource_manager_impl.cc ('k') | content/browser/android/ui_resource_provider_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698