| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/ui/cocoa/table_row_nsimage_cache.h" | 5 #include "chrome/browser/ui/cocoa/table_row_nsimage_cache.h" |
| 6 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "third_party/skia/include/core/SkBitmap.h" | 8 #include "third_party/skia/include/core/SkBitmap.h" |
| 9 #include "ui/gfx/image/image_skia.h" | 9 #include "ui/gfx/image/image_skia.h" |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 class TestTable : public TableRowNSImageCache::Table { | 13 class TestTable : public TableRowNSImageCache::Table { |
| 14 public: | 14 public: |
| 15 | 15 |
| 16 std::vector<SkBitmap>* rows() { | 16 std::vector<SkBitmap>* rows() { |
| 17 return &rows_; | 17 return &rows_; |
| 18 } | 18 } |
| 19 | 19 |
| 20 // TableRowNSImageCache::Table overrides. | 20 // TableRowNSImageCache::Table overrides. |
| 21 virtual int RowCount() const OVERRIDE { | 21 virtual int RowCount() const override { |
| 22 return rows_.size(); | 22 return rows_.size(); |
| 23 } | 23 } |
| 24 virtual gfx::ImageSkia GetIcon(int index) const OVERRIDE { | 24 virtual gfx::ImageSkia GetIcon(int index) const override { |
| 25 return gfx::ImageSkia::CreateFrom1xBitmap(rows_[index]); | 25 return gfx::ImageSkia::CreateFrom1xBitmap(rows_[index]); |
| 26 } | 26 } |
| 27 | 27 |
| 28 private: | 28 private: |
| 29 std::vector<SkBitmap> rows_; | 29 std::vector<SkBitmap> rows_; |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 SkBitmap MakeImage(int width, int height) { | 32 SkBitmap MakeImage(int width, int height) { |
| 33 SkBitmap image; | 33 SkBitmap image; |
| 34 image.allocN32Pixels(width, height); | 34 image.allocN32Pixels(width, height); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 cache.OnItemsRemoved(1, 3); | 191 cache.OnItemsRemoved(1, 3); |
| 192 | 192 |
| 193 image0 = cache.GetImageForRow(0); | 193 image0 = cache.GetImageForRow(0); |
| 194 image1 = cache.GetImageForRow(1); | 194 image1 = cache.GetImageForRow(1); |
| 195 | 195 |
| 196 COMPARE_SK_NS_IMG_SIZES(rows->at(0), image0); | 196 COMPARE_SK_NS_IMG_SIZES(rows->at(0), image0); |
| 197 COMPARE_SK_NS_IMG_SIZES(rows->at(1), image1); | 197 COMPARE_SK_NS_IMG_SIZES(rows->at(1), image1); |
| 198 } | 198 } |
| 199 | 199 |
| 200 } // namespace | 200 } // namespace |
| OLD | NEW |