OLD | NEW |
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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 int width() { return view_->width(); } | 189 int width() { return view_->width(); } |
190 | 190 |
191 bool IsLabelVisible() { return view_->IsLabelVisible(); } | 191 bool IsLabelVisible() { return view_->IsLabelVisible(); } |
192 | 192 |
193 const gfx::Rect& GetLabelBounds() const { return view_->GetLabelBounds(); } | 193 const gfx::Rect& GetLabelBounds() const { return view_->GetLabelBounds(); } |
194 | 194 |
195 const gfx::Rect& GetImageBounds() const { | 195 const gfx::Rect& GetImageBounds() const { |
196 return view_->GetImageView()->bounds(); | 196 return view_->GetImageView()->bounds(); |
197 } | 197 } |
198 | 198 |
199 scoped_ptr<TestIconLabelBubbleView> view_; | 199 std::unique_ptr<TestIconLabelBubbleView> view_; |
200 | 200 |
201 bool steady_reached_; | 201 bool steady_reached_; |
202 bool shrinking_reached_; | 202 bool shrinking_reached_; |
203 bool minimum_size_reached_; | 203 bool minimum_size_reached_; |
204 int previous_width_; | 204 int previous_width_; |
205 int initial_image_x_; | 205 int initial_image_x_; |
206 }; | 206 }; |
207 | 207 |
208 // Tests layout rules for IconLabelBubbleView while simulating animation. | 208 // Tests layout rules for IconLabelBubbleView while simulating animation. |
209 // The animation is first growing the bubble from zero, then keeping its size | 209 // The animation is first growing the bubble from zero, then keeping its size |
210 // constant and finally shrinking it down to its minimum size which is the image | 210 // constant and finally shrinking it down to its minimum size which is the image |
211 // size. | 211 // size. |
212 // Various step sizes during animation simulate different possible timing. | 212 // Various step sizes during animation simulate different possible timing. |
213 TEST_F(IconLabelBubbleViewTest, AnimateLayout) { | 213 TEST_F(IconLabelBubbleViewTest, AnimateLayout) { |
214 VerifyWithAnimationStep(1); | 214 VerifyWithAnimationStep(1); |
215 VerifyWithAnimationStep(5); | 215 VerifyWithAnimationStep(5); |
216 VerifyWithAnimationStep(10); | 216 VerifyWithAnimationStep(10); |
217 VerifyWithAnimationStep(25); | 217 VerifyWithAnimationStep(25); |
218 } | 218 } |
OLD | NEW |