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

Side by Side Diff: chrome/browser/ui/views/location_bar/icon_label_bubble_view_unittest.cc

Issue 1834933002: Misc. cleanup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix missing spacing Created 4 years, 8 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 | « chrome/browser/ui/views/location_bar/icon_label_bubble_view.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/views/location_bar/icon_label_bubble_view.h" 5 #include "chrome/browser/ui/views/location_bar/icon_label_bubble_view.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/views/controls/image_view.h" 9 #include "ui/views/controls/image_view.h"
10 #include "ui/views/test/views_test_base.h" 10 #include "ui/views/test/views_test_base.h"
(...skipping 19 matching lines...) Expand all
30 : IconLabelBubbleView(0, font_list, color, false), value_(0) { 30 : IconLabelBubbleView(0, font_list, color, false), value_(0) {
31 GetImageView()->SetImageSize(gfx::Size(kImageSize, kImageSize)); 31 GetImageView()->SetImageSize(gfx::Size(kImageSize, kImageSize));
32 SetLabel(base::ASCIIToUTF16("Label")); 32 SetLabel(base::ASCIIToUTF16("Label"));
33 } 33 }
34 34
35 void SetCurrentAnimationValue(int value) { 35 void SetCurrentAnimationValue(int value) {
36 value_ = value; 36 value_ = value;
37 SizeToPreferredSize(); 37 SizeToPreferredSize();
38 } 38 }
39 39
40 int width() { return bounds().width(); } 40 int width() const { return bounds().width(); }
41 bool IsLabelVisible() const { return label()->visible(); } 41 bool IsLabelVisible() const { return label()->visible(); }
42 void SetLabelVisible(bool visible) { label()->SetVisible(visible); } 42 void SetLabelVisible(bool visible) { label()->SetVisible(visible); }
43 const gfx::Rect& GetLabelBounds() const { return label()->bounds(); } 43 const gfx::Rect& GetLabelBounds() const { return label()->bounds(); }
44 44
45 State state() const { 45 State state() const {
46 const double kOpenFraction = 46 const double kOpenFraction =
47 static_cast<double>(kOpenTimeMS) / kAnimationDurationMS; 47 static_cast<double>(kOpenTimeMS) / kAnimationDurationMS;
48 double state = value_ / (double)kNumberOfSteps; 48 double state = value_ / (double)kNumberOfSteps;
49 if (state < kOpenFraction) 49 if (state < kOpenFraction)
50 return GROWING; 50 return GROWING;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 // The animation is first growing the bubble from zero, then keeping its size 208 // The animation is first growing the bubble from zero, then keeping its size
209 // constant and finally shrinking it down to its minimum size which is the image 209 // constant and finally shrinking it down to its minimum size which is the image
210 // size. 210 // size.
211 // Various step sizes during animation simulate different possible timing. 211 // Various step sizes during animation simulate different possible timing.
212 TEST_F(IconLabelBubbleViewTest, AnimateLayout) { 212 TEST_F(IconLabelBubbleViewTest, AnimateLayout) {
213 VerifyWithAnimationStep(1); 213 VerifyWithAnimationStep(1);
214 VerifyWithAnimationStep(5); 214 VerifyWithAnimationStep(5);
215 VerifyWithAnimationStep(10); 215 VerifyWithAnimationStep(10);
216 VerifyWithAnimationStep(25); 216 VerifyWithAnimationStep(25);
217 } 217 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698