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

Side by Side Diff: ui/gfx/image/image_skia_unittest.cc

Issue 12213093: Remove ImageLoadingTracker class (Closed) Base URL: https://git.chromium.org/chromium/src.git@Issue_163929
Patch Set: Fix merge conflict Created 7 years, 10 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
« no previous file with comments | « ui/gfx/image/image_skia.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 (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 "ui/gfx/image/image_skia.h" 5 #include "ui/gfx/image/image_skia.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/threading/simple_thread.h" 8 #include "base/threading/simple_thread.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"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // Get the representation again and make sure it doesn't 165 // Get the representation again and make sure it doesn't
166 // generate new image skia rep. 166 // generate new image skia rep.
167 image_skia.GetRepresentation(ui::SCALE_FACTOR_100P); 167 image_skia.GetRepresentation(ui::SCALE_FACTOR_100P);
168 EXPECT_EQ(2U, image_skia.image_reps().size()); 168 EXPECT_EQ(2U, image_skia.image_reps().size());
169 image_skia.GetRepresentation(ui::SCALE_FACTOR_200P); 169 image_skia.GetRepresentation(ui::SCALE_FACTOR_200P);
170 EXPECT_EQ(2U, image_skia.image_reps().size()); 170 EXPECT_EQ(2U, image_skia.image_reps().size());
171 } 171 }
172 172
173 // Tests that image_reps returns all of the representations in the 173 // Tests that image_reps returns all of the representations in the
174 // image when there are multiple representations for a scale factor. 174 // image when there are multiple representations for a scale factor.
175 // This currently is the case with ImageLoadingTracker::LoadImages. 175 // This currently is the case with ImageLoader::LoadImages.
176 TEST(ImageSkiaTest, ManyRepsPerScaleFactor) { 176 TEST(ImageSkiaTest, ManyRepsPerScaleFactor) {
177 const int kSmallIcon1x = 16; 177 const int kSmallIcon1x = 16;
178 const int kSmallIcon2x = 32; 178 const int kSmallIcon2x = 32;
179 const int kLargeIcon1x = 32; 179 const int kLargeIcon1x = 32;
180 180
181 ImageSkia image(new NullSource(), gfx::Size(kSmallIcon1x, kSmallIcon1x)); 181 ImageSkia image(new NullSource(), gfx::Size(kSmallIcon1x, kSmallIcon1x));
182 // Simulate a source which loads images on a delay. Upon 182 // Simulate a source which loads images on a delay. Upon
183 // GetImageForScaleFactor, it immediately returns null and starts loading 183 // GetImageForScaleFactor, it immediately returns null and starts loading
184 // image reps slowly. 184 // image reps slowly.
185 image.GetRepresentation(ui::SCALE_FACTOR_100P); 185 image.GetRepresentation(ui::SCALE_FACTOR_100P);
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 EXPECT_FALSE(threadsafe_on_thread.can_modify()); 373 EXPECT_FALSE(threadsafe_on_thread.can_modify());
374 EXPECT_TRUE(image.CanRead()); 374 EXPECT_TRUE(image.CanRead());
375 EXPECT_FALSE(image.CanModify()); 375 EXPECT_FALSE(image.CanModify());
376 } 376 }
377 #endif // ENABLE_NON_THREAD_SAFE 377 #endif // ENABLE_NON_THREAD_SAFE
378 378
379 // Just in case we ever get lumped together with other compilation units. 379 // Just in case we ever get lumped together with other compilation units.
380 #undef ENABLE_NON_THREAD_SAFE 380 #undef ENABLE_NON_THREAD_SAFE
381 381
382 } // namespace gfx 382 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/image/image_skia.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698