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

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

Issue 1464313007: cc: Introduce CompositorMode enum. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change ui::MockLayerTreeHost Created 5 years 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 | « cc/trees/layer_tree_host.cc ('k') | no next file » | 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 "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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 SetResourceAsLoaded(res_type, res_id); 62 SetResourceAsLoaded(res_type, res_id);
63 } 63 }
64 }; 64 };
65 65
66 namespace { 66 namespace {
67 67
68 const ui::SystemUIResourceType kTestResourceType = ui::OVERSCROLL_GLOW; 68 const ui::SystemUIResourceType kTestResourceType = ui::OVERSCROLL_GLOW;
69 69
70 class MockLayerTreeHost : public cc::LayerTreeHost { 70 class MockLayerTreeHost : public cc::LayerTreeHost {
71 public: 71 public:
72 MockLayerTreeHost(cc::LayerTreeHost::InitParams* params) 72 MockLayerTreeHost(cc::LayerTreeHost::InitParams* params,
73 : cc::LayerTreeHost(params) {} 73 cc::CompositorMode mode)
74 : cc::LayerTreeHost(params, mode) {}
74 75
75 MOCK_METHOD1(CreateUIResource, cc::UIResourceId(cc::UIResourceClient*)); 76 MOCK_METHOD1(CreateUIResource, cc::UIResourceId(cc::UIResourceClient*));
76 MOCK_METHOD1(DeleteUIResource, void(cc::UIResourceId)); 77 MOCK_METHOD1(DeleteUIResource, void(cc::UIResourceId));
77 78
78 private: 79 private:
79 DISALLOW_COPY_AND_ASSIGN(MockLayerTreeHost); 80 DISALLOW_COPY_AND_ASSIGN(MockLayerTreeHost);
80 }; 81 };
81 82
82 } // namespace 83 } // namespace
83 84
84 class ResourceManagerTest : public testing::Test { 85 class ResourceManagerTest : public testing::Test {
85 public: 86 public:
86 ResourceManagerTest() 87 ResourceManagerTest()
87 : window_android_(WindowAndroid::createForTesting()), 88 : window_android_(WindowAndroid::createForTesting()),
88 resource_manager_(window_android_), 89 resource_manager_(window_android_),
89 fake_client_(cc::FakeLayerTreeHostClient::DIRECT_3D) { 90 fake_client_(cc::FakeLayerTreeHostClient::DIRECT_3D) {
90 cc::LayerTreeHost::InitParams params; 91 cc::LayerTreeHost::InitParams params;
91 cc::LayerTreeSettings settings; 92 cc::LayerTreeSettings settings;
92 params.client = &fake_client_; 93 params.client = &fake_client_;
93 params.settings = &settings; 94 params.settings = &settings;
94 params.task_graph_runner = &task_graph_runner_; 95 params.task_graph_runner = &task_graph_runner_;
95 host_.reset(new MockLayerTreeHost(&params)); 96 host_.reset(new MockLayerTreeHost(&params,
97 cc::CompositorMode::SingleThreaded));
96 resource_manager_.Init(host_.get()); 98 resource_manager_.Init(host_.get());
97 } 99 }
98 100
99 ~ResourceManagerTest() override { window_android_->Destroy(NULL, NULL); } 101 ~ResourceManagerTest() override { window_android_->Destroy(NULL, NULL); }
100 102
101 void PreloadResource(ui::SystemUIResourceType type) { 103 void PreloadResource(ui::SystemUIResourceType type) {
102 resource_manager_.PreloadResource(ui::ANDROID_RESOURCE_TYPE_SYSTEM, type); 104 resource_manager_.PreloadResource(ui::ANDROID_RESOURCE_TYPE_SYSTEM, type);
103 } 105 }
104 106
105 cc::UIResourceId GetUIResourceId(ui::SystemUIResourceType type) { 107 cc::UIResourceId GetUIResourceId(ui::SystemUIResourceType type) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 EXPECT_EQ(kNumFrames, actual_rects.size()); 175 EXPECT_EQ(kNumFrames, actual_rects.size());
174 for (size_t i = 0; i < kNumFrames; i++) { 176 for (size_t i = 0; i < kNumFrames; i++) {
175 EXPECT_EQ(expected_rects[i].size(), actual_rects[i].size()); 177 EXPECT_EQ(expected_rects[i].size(), actual_rects[i].size());
176 for (size_t j = 0; j < actual_rects[i].size(); j++) { 178 for (size_t j = 0; j < actual_rects[i].size(); j++) {
177 EXPECT_EQ(expected_rects[i][j], actual_rects[i][j]); 179 EXPECT_EQ(expected_rects[i][j], actual_rects[i][j]);
178 } 180 }
179 } 181 }
180 } 182 }
181 183
182 } // namespace ui 184 } // namespace ui
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698