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

Side by Side Diff: cc/layers/scrollbar_layer_unittest.cc

Issue 22870016: Update the nine patch layer to use UI resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: UIResourceBitmap holds SkPixelRef* instead of uint8_t* Created 7 years, 3 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "base/containers/hash_tables.h" 5 #include "base/containers/hash_tables.h"
6 #include "cc/animation/scrollbar_animation_controller.h" 6 #include "cc/animation/scrollbar_animation_controller.h"
7 #include "cc/debug/test_web_graphics_context_3d.h" 7 #include "cc/debug/test_web_graphics_context_3d.h"
8 #include "cc/layers/append_quads_data.h" 8 #include "cc/layers/append_quads_data.h"
9 #include "cc/layers/painted_scrollbar_layer.h" 9 #include "cc/layers/painted_scrollbar_layer.h"
10 #include "cc/layers/painted_scrollbar_layer_impl.h" 10 #include "cc/layers/painted_scrollbar_layer_impl.h"
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 total_ui_resource_deleted_++; 534 total_ui_resource_deleted_++;
535 } 535 }
536 } 536 }
537 537
538 size_t UIResourceCount() { return ui_resource_bitmap_map_.size(); } 538 size_t UIResourceCount() { return ui_resource_bitmap_map_.size(); }
539 int TotalUIResourceDeleted() { return total_ui_resource_deleted_; } 539 int TotalUIResourceDeleted() { return total_ui_resource_deleted_; }
540 int TotalUIResourceCreated() { return total_ui_resource_created_; } 540 int TotalUIResourceCreated() { return total_ui_resource_created_; }
541 541
542 gfx::Size ui_resource_size(UIResourceId id) { 542 gfx::Size ui_resource_size(UIResourceId id) {
543 UIResourceBitmapMap::iterator iter = ui_resource_bitmap_map_.find(id); 543 UIResourceBitmapMap::iterator iter = ui_resource_bitmap_map_.find(id);
544 if (iter != ui_resource_bitmap_map_.end() && iter->second.get()) 544 if (iter != ui_resource_bitmap_map_.end())
545 return iter->second->GetSize(); 545 return iter->second.GetSize();
546 return gfx::Size(); 546 return gfx::Size();
547 } 547 }
548 548
549 private: 549 private:
550 typedef base::hash_map<UIResourceId, scoped_refptr<UIResourceBitmap> > 550 typedef base::hash_map<UIResourceId, UIResourceBitmap>
551 UIResourceBitmapMap; 551 UIResourceBitmapMap;
552 UIResourceBitmapMap ui_resource_bitmap_map_; 552 UIResourceBitmapMap ui_resource_bitmap_map_;
553 553
554 int next_id_; 554 int next_id_;
555 int total_ui_resource_created_; 555 int total_ui_resource_created_;
556 int total_ui_resource_deleted_; 556 int total_ui_resource_deleted_;
557 }; 557 };
558 558
559 559
560 class ScrollbarLayerTestResourceCreation : public testing::Test { 560 class ScrollbarLayerTestResourceCreation : public testing::Test {
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 TEST_F(ScaledScrollbarLayerTestResourceCreation, ScaledResourceUpload) { 724 TEST_F(ScaledScrollbarLayerTestResourceCreation, ScaledResourceUpload) {
725 // Pick a test scale that moves the scrollbar's (non-zero) position to 725 // Pick a test scale that moves the scrollbar's (non-zero) position to
726 // a non-pixel-aligned location. 726 // a non-pixel-aligned location.
727 TestResourceUpload(.041f); 727 TestResourceUpload(.041f);
728 TestResourceUpload(1.41f); 728 TestResourceUpload(1.41f);
729 TestResourceUpload(4.1f); 729 TestResourceUpload(4.1f);
730 } 730 }
731 731
732 } // namespace 732 } // namespace
733 } // namespace cc 733 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698