| OLD | NEW |
| 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 "ui/message_center/views/message_popup_collection.h" | 5 #include "ui/message_center/views/message_popup_collection.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <list> | 10 #include <list> |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 } | 263 } |
| 264 } | 264 } |
| 265 }; | 265 }; |
| 266 | 266 |
| 267 void MessagePopupCollectionTest::CheckedAnimationDelegate:: | 267 void MessagePopupCollectionTest::CheckedAnimationDelegate:: |
| 268 CheckToastsAreAligned(const std::string& calling_func) { | 268 CheckToastsAreAligned(const std::string& calling_func) { |
| 269 if (error_msg_) | 269 if (error_msg_) |
| 270 return; | 270 return; |
| 271 auto poorly_aligned = std::adjacent_find( | 271 auto poorly_aligned = std::adjacent_find( |
| 272 toasts_->begin(), toasts_->end(), | 272 toasts_->begin(), toasts_->end(), |
| 273 [this](ToastContentsView* top, ToastContentsView* bottom) { | 273 [](ToastContentsView* top, ToastContentsView* bottom) { |
| 274 return ComputeYDistance(*top, *bottom) != kMarginBetweenItems; | 274 return ComputeYDistance(*top, *bottom) != kMarginBetweenItems; |
| 275 }); | 275 }); |
| 276 if (poorly_aligned != toasts_->end()) | 276 if (poorly_aligned != toasts_->end()) |
| 277 error_msg_ = calling_func + " CheckToastsAreAligned: distance between: " + | 277 error_msg_ = calling_func + " CheckToastsAreAligned: distance between: " + |
| 278 (*poorly_aligned)->id() + ' ' + | 278 (*poorly_aligned)->id() + ' ' + |
| 279 (*std::next(poorly_aligned))->id() + ": " + | 279 (*std::next(poorly_aligned))->id() + ": " + |
| 280 std::to_string(ComputeYDistance(**poorly_aligned, | 280 std::to_string(ComputeYDistance(**poorly_aligned, |
| 281 **std::next(poorly_aligned))) + | 281 **std::next(poorly_aligned))) + |
| 282 " expected: " + std::to_string(kMarginBetweenItems) + | 282 " expected: " + std::to_string(kMarginBetweenItems) + |
| 283 "\nLayout:\n" + YPositionsToString(*toasts_); | 283 "\nLayout:\n" + YPositionsToString(*toasts_); |
| 284 } | 284 } |
| 285 | 285 |
| 286 void MessagePopupCollectionTest::CheckedAnimationDelegate:: | 286 void MessagePopupCollectionTest::CheckedAnimationDelegate:: |
| 287 CheckToastsDontOverlap(const std::string& calling_func) { | 287 CheckToastsDontOverlap(const std::string& calling_func) { |
| 288 if (error_msg_) | 288 if (error_msg_) |
| 289 return; | 289 return; |
| 290 auto poorly_aligned = std::adjacent_find( | 290 auto poorly_aligned = std::adjacent_find( |
| 291 toasts_->begin(), toasts_->end(), | 291 toasts_->begin(), toasts_->end(), |
| 292 [this](ToastContentsView* top, ToastContentsView* bottom) { | 292 [](ToastContentsView* top, ToastContentsView* bottom) { |
| 293 return ComputeYDistance(*top, *bottom) < 0; | 293 return ComputeYDistance(*top, *bottom) < 0; |
| 294 }); | 294 }); |
| 295 if (poorly_aligned != toasts_->end()) | 295 if (poorly_aligned != toasts_->end()) |
| 296 error_msg_ = calling_func + " CheckToastsDontOverlap: distance between: " + | 296 error_msg_ = calling_func + " CheckToastsDontOverlap: distance between: " + |
| 297 (*poorly_aligned)->id() + ' ' + | 297 (*poorly_aligned)->id() + ' ' + |
| 298 (*std::next(poorly_aligned))->id() + ": " + | 298 (*std::next(poorly_aligned))->id() + ": " + |
| 299 std::to_string(ComputeYDistance(**poorly_aligned, | 299 std::to_string(ComputeYDistance(**poorly_aligned, |
| 300 **std::next(poorly_aligned))) + | 300 **std::next(poorly_aligned))) + |
| 301 "\nLayout:\n" + YPositionsToString(*toasts_); | 301 "\nLayout:\n" + YPositionsToString(*toasts_); |
| 302 } | 302 } |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 << *checked_animation.error_msg(); | 743 << *checked_animation.error_msg(); |
| 744 } | 744 } |
| 745 } | 745 } |
| 746 | 746 |
| 747 CloseAllToasts(); | 747 CloseAllToasts(); |
| 748 WaitForTransitionsDone(); | 748 WaitForTransitionsDone(); |
| 749 } | 749 } |
| 750 | 750 |
| 751 } // namespace test | 751 } // namespace test |
| 752 } // namespace message_center | 752 } // namespace message_center |
| OLD | NEW |