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

Side by Side Diff: chrome/browser/ui/toolbar/wrench_icon_painter_unittest.cc

Issue 24175004: Remove dependency on ui::ScaleFactor from ui/gfx (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename methods and vars to make image_scale more clear 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/toolbar/wrench_icon_painter.h" 5 #include "chrome/browser/ui/toolbar/wrench_icon_painter.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "chrome/browser/themes/theme_service.h" 8 #include "chrome/browser/themes/theme_service.h"
9 #include "chrome/browser/themes/theme_service_factory.h" 9 #include "chrome/browser/themes/theme_service_factory.h"
10 #include "chrome/test/base/testing_profile.h" 10 #include "chrome/test/base/testing_profile.h"
(...skipping 19 matching lines...) Expand all
30 WrenchIconPainter painter_; 30 WrenchIconPainter painter_;
31 31
32 private: 32 private:
33 DISALLOW_COPY_AND_ASSIGN(WrenchIconPainterTest); 33 DISALLOW_COPY_AND_ASSIGN(WrenchIconPainterTest);
34 }; 34 };
35 35
36 // Nothing to test here. Just exercise the paint code to verify that nothing 36 // Nothing to test here. Just exercise the paint code to verify that nothing
37 // leaks or crashes. 37 // leaks or crashes.
38 TEST_F(WrenchIconPainterTest, Paint) { 38 TEST_F(WrenchIconPainterTest, Paint) {
39 gfx::Rect rect(0, 0, 29, 29); 39 gfx::Rect rect(0, 0, 29, 29);
40 gfx::Canvas canvas(rect.size(), ui::SCALE_FACTOR_100P, true); 40 gfx::Canvas canvas(rect.size(), 1.0f, true);
41 41
42 painter_.Paint(&canvas, theme_provider_, rect, WrenchIconPainter::BEZEL_NONE); 42 painter_.Paint(&canvas, theme_provider_, rect, WrenchIconPainter::BEZEL_NONE);
43 painter_.Paint( 43 painter_.Paint(
44 &canvas, theme_provider_, rect, WrenchIconPainter::BEZEL_HOVER); 44 &canvas, theme_provider_, rect, WrenchIconPainter::BEZEL_HOVER);
45 painter_.Paint( 45 painter_.Paint(
46 &canvas, theme_provider_, rect, WrenchIconPainter::BEZEL_PRESSED); 46 &canvas, theme_provider_, rect, WrenchIconPainter::BEZEL_PRESSED);
47 47
48 painter_.SetSeverity(WrenchIconPainter::SEVERITY_LOW, true); 48 painter_.SetSeverity(WrenchIconPainter::SEVERITY_LOW, true);
49 painter_.Paint( 49 painter_.Paint(
50 &canvas, theme_provider_, rect, WrenchIconPainter::BEZEL_PRESSED); 50 &canvas, theme_provider_, rect, WrenchIconPainter::BEZEL_PRESSED);
51 painter_.SetSeverity(WrenchIconPainter::SEVERITY_MEDIUM, true); 51 painter_.SetSeverity(WrenchIconPainter::SEVERITY_MEDIUM, true);
52 painter_.Paint( 52 painter_.Paint(
53 &canvas, theme_provider_, rect, WrenchIconPainter::BEZEL_PRESSED); 53 &canvas, theme_provider_, rect, WrenchIconPainter::BEZEL_PRESSED);
54 painter_.SetSeverity(WrenchIconPainter::SEVERITY_HIGH, true); 54 painter_.SetSeverity(WrenchIconPainter::SEVERITY_HIGH, true);
55 painter_.Paint( 55 painter_.Paint(
56 &canvas, theme_provider_, rect, WrenchIconPainter::BEZEL_PRESSED); 56 &canvas, theme_provider_, rect, WrenchIconPainter::BEZEL_PRESSED);
57 57
58 painter_.set_badge(*theme_provider_->GetImageSkiaNamed(IDR_PRODUCT_LOGO_16)); 58 painter_.set_badge(*theme_provider_->GetImageSkiaNamed(IDR_PRODUCT_LOGO_16));
59 painter_.Paint( 59 painter_.Paint(
60 &canvas, theme_provider_, rect, WrenchIconPainter::BEZEL_PRESSED); 60 &canvas, theme_provider_, rect, WrenchIconPainter::BEZEL_PRESSED);
61 } 61 }
62 62
63 TEST_F(WrenchIconPainterTest, PaintCallback) { 63 TEST_F(WrenchIconPainterTest, PaintCallback) {
64 painter_.SetSeverity(WrenchIconPainter::SEVERITY_LOW, true); 64 painter_.SetSeverity(WrenchIconPainter::SEVERITY_LOW, true);
65 schedule_paint_count_ = 0; 65 schedule_paint_count_ = 0;
66 painter_.AnimationProgressed(NULL); 66 painter_.AnimationProgressed(NULL);
67 EXPECT_EQ(1, schedule_paint_count_); 67 EXPECT_EQ(1, schedule_paint_count_);
68 } 68 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698