Add ICU message format support
[chromium-blink-merge.git] / cc / test / fake_scoped_ui_resource.cc
blob0631cd846cd1db247bad09c2919c075e392261ae
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "cc/test/fake_scoped_ui_resource.h"
7 #include "cc/trees/layer_tree_host.h"
9 namespace cc {
11 namespace {
13 UIResourceBitmap CreateMockUIResourceBitmap() {
14 bool is_opaque = false;
15 return UIResourceBitmap(gfx::Size(1, 1), is_opaque);
18 } // anonymous namespace
20 scoped_ptr<FakeScopedUIResource> FakeScopedUIResource::Create(
21 LayerTreeHost* host) {
22 return make_scoped_ptr(new FakeScopedUIResource(host));
25 FakeScopedUIResource::FakeScopedUIResource(LayerTreeHost* host)
26 : ScopedUIResource(host, CreateMockUIResourceBitmap()) {
27 // The constructor of ScopedUIResource already created a resource so we need
28 // to delete the created resource to wipe the state clean.
29 host_->DeleteUIResource(id_);
30 ResetCounters();
31 id_ = host_->CreateUIResource(this);
34 UIResourceBitmap FakeScopedUIResource::GetBitmap(UIResourceId uid,
35 bool resource_lost) {
36 resource_create_count++;
37 if (resource_lost)
38 lost_resource_count++;
39 return ScopedUIResource::GetBitmap(uid, resource_lost);
42 void FakeScopedUIResource::ResetCounters() {
43 resource_create_count = 0;
44 lost_resource_count = 0;
47 } // namespace cc