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

Side by Side Diff: ui/message_center/views/notification_view_unittest.cc

Issue 2970953002: Revert of Use shared NotificationControlButtonsView for non-arc notification buttons (Closed)
Patch Set: Created 3 years, 5 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/message_center/views/notification_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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/notification_view.h" 5 #include "ui/message_center/views/notification_view.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 11 matching lines...) Expand all
22 #include "ui/gfx/geometry/size.h" 22 #include "ui/gfx/geometry/size.h"
23 #include "ui/gfx/image/image.h" 23 #include "ui/gfx/image/image.h"
24 #include "ui/message_center/message_center_style.h" 24 #include "ui/message_center/message_center_style.h"
25 #include "ui/message_center/notification.h" 25 #include "ui/message_center/notification.h"
26 #include "ui/message_center/notification_list.h" 26 #include "ui/message_center/notification_list.h"
27 #include "ui/message_center/notification_types.h" 27 #include "ui/message_center/notification_types.h"
28 #include "ui/message_center/views/constants.h" 28 #include "ui/message_center/views/constants.h"
29 #include "ui/message_center/views/message_center_controller.h" 29 #include "ui/message_center/views/message_center_controller.h"
30 #include "ui/message_center/views/message_view_factory.h" 30 #include "ui/message_center/views/message_view_factory.h"
31 #include "ui/message_center/views/notification_button.h" 31 #include "ui/message_center/views/notification_button.h"
32 #include "ui/message_center/views/notification_control_buttons_view.h"
33 #include "ui/message_center/views/padded_button.h"
34 #include "ui/message_center/views/proportional_image_view.h" 32 #include "ui/message_center/views/proportional_image_view.h"
35 #include "ui/views/controls/button/image_button.h" 33 #include "ui/views/controls/button/image_button.h"
36 #include "ui/views/layout/fill_layout.h" 34 #include "ui/views/layout/fill_layout.h"
37 #include "ui/views/test/views_test_base.h" 35 #include "ui/views/test/views_test_base.h"
38 #include "ui/views/test/widget_test.h" 36 #include "ui/views/test/widget_test.h"
39 #include "ui/views/widget/widget_delegate.h" 37 #include "ui/views/widget/widget_delegate.h"
40 38
41 namespace message_center { 39 namespace message_center {
42 40
43 // A test delegate used for tests that deal with the notification settings 41 // A test delegate used for tests that deal with the notification settings
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 153
156 gfx::Point current_point = (*current)->origin(); 154 gfx::Point current_point = (*current)->origin();
157 views::View::ConvertPointToTarget( 155 views::View::ConvertPointToTarget(
158 (*current), notification_view(), &current_point); 156 (*current), notification_view(), &current_point);
159 157
160 EXPECT_LT(last_point.y(), current_point.y()); 158 EXPECT_LT(last_point.y(), current_point.y());
161 last = current++; 159 last = current++;
162 } 160 }
163 } 161 }
164 162
165 PaddedButton* GetCloseButton() { 163 views::ImageButton* GetCloseButton() {
166 return notification_view() 164 return notification_view()->close_button();
167 ->control_buttons_view_->close_button_for_testing();
168 }
169
170 PaddedButton* GetSettingsButton() {
171 return notification_view()
172 ->control_buttons_view_->settings_button_for_testing();
173 } 165 }
174 166
175 void UpdateNotificationViews() { 167 void UpdateNotificationViews() {
176 notification_view()->UpdateWithNotification(*notification()); 168 notification_view()->UpdateWithNotification(*notification());
177 } 169 }
178 170
179 float GetNotificationSlideAmount() const { 171 float GetNotificationSlideAmount() const {
180 return notification_view_->GetSlideOutLayer() 172 return notification_view_->GetSlideOutLayer()
181 ->transform() 173 ->transform()
182 .To2dTranslation() 174 .To2dTranslation()
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 EXPECT_TRUE(NULL != notification_view()->title_view_); 301 EXPECT_TRUE(NULL != notification_view()->title_view_);
310 EXPECT_TRUE(NULL != notification_view()->message_view_); 302 EXPECT_TRUE(NULL != notification_view()->message_view_);
311 EXPECT_TRUE(NULL != notification_view()->icon_view_); 303 EXPECT_TRUE(NULL != notification_view()->icon_view_);
312 EXPECT_TRUE(NULL != notification_view()->image_view_); 304 EXPECT_TRUE(NULL != notification_view()->image_view_);
313 305
314 notification()->set_image(gfx::Image()); 306 notification()->set_image(gfx::Image());
315 notification()->set_title(base::ASCIIToUTF16("")); 307 notification()->set_title(base::ASCIIToUTF16(""));
316 notification()->set_message(base::ASCIIToUTF16("")); 308 notification()->set_message(base::ASCIIToUTF16(""));
317 notification()->set_icon(gfx::Image()); 309 notification()->set_icon(gfx::Image());
318 310
319 notification_view()->UpdateWithNotification(*notification()); 311 notification_view()->CreateOrUpdateViews(*notification());
320 EXPECT_TRUE(NULL == notification_view()->title_view_); 312 EXPECT_TRUE(NULL == notification_view()->title_view_);
321 EXPECT_TRUE(NULL == notification_view()->message_view_); 313 EXPECT_TRUE(NULL == notification_view()->message_view_);
322 EXPECT_TRUE(NULL == notification_view()->image_view_); 314 EXPECT_TRUE(NULL == notification_view()->image_view_);
323 // Notification must have a control buttons view. 315 EXPECT_TRUE(NULL == notification_view()->settings_button_view_);
324 EXPECT_TRUE(NULL != notification_view()->control_buttons_view_);
325 // Notification is not pinned and have a close button by default.
326 EXPECT_TRUE(NULL != GetCloseButton());
327 // Notification doesn't have a settings button by default.
328 EXPECT_TRUE(NULL == GetSettingsButton());
329 // We still expect an icon view for all layouts. 316 // We still expect an icon view for all layouts.
330 EXPECT_TRUE(NULL != notification_view()->icon_view_); 317 EXPECT_TRUE(NULL != notification_view()->icon_view_);
331 } 318 }
332 319
333 TEST_F(NotificationViewTest, CreateOrUpdateTestSettingsButton) { 320 TEST_F(NotificationViewTest, CreateOrUpdateTestSettingsButton) {
334 scoped_refptr<NotificationSettingsDelegate> delegate = 321 scoped_refptr<NotificationSettingsDelegate> delegate =
335 new NotificationSettingsDelegate(); 322 new NotificationSettingsDelegate();
336 Notification notf(NOTIFICATION_TYPE_BASE_FORMAT, 323 Notification notf(NOTIFICATION_TYPE_BASE_FORMAT,
337 std::string("notification id"), base::UTF8ToUTF16("title"), 324 std::string("notification id"), base::UTF8ToUTF16("title"),
338 base::UTF8ToUTF16("message"), CreateTestImage(80, 80), 325 base::UTF8ToUTF16("message"), CreateTestImage(80, 80),
339 base::UTF8ToUTF16("display source"), 326 base::UTF8ToUTF16("display source"),
340 GURL("https://hello.com"), 327 GURL("https://hello.com"),
341 NotifierId(NotifierId::APPLICATION, "extension_id"), 328 NotifierId(NotifierId::APPLICATION, "extension_id"),
342 *data(), delegate.get()); 329 *data(), delegate.get());
343 330
344 notification_view()->UpdateWithNotification(notf); 331 notification_view()->CreateOrUpdateViews(notf);
345 EXPECT_TRUE(NULL != notification_view()->title_view_); 332 EXPECT_TRUE(NULL != notification_view()->title_view_);
346 EXPECT_TRUE(NULL != notification_view()->message_view_); 333 EXPECT_TRUE(NULL != notification_view()->message_view_);
347 EXPECT_TRUE(NULL != notification_view()->context_message_view_); 334 EXPECT_TRUE(NULL != notification_view()->context_message_view_);
348 EXPECT_TRUE(NULL != GetCloseButton()); 335 EXPECT_TRUE(NULL != notification_view()->settings_button_view_);
349 EXPECT_TRUE(NULL != GetSettingsButton());
350 EXPECT_TRUE(NULL != notification_view()->icon_view_); 336 EXPECT_TRUE(NULL != notification_view()->icon_view_);
351 337
352 EXPECT_TRUE(NULL == notification_view()->image_view_); 338 EXPECT_TRUE(NULL == notification_view()->image_view_);
353 } 339 }
354 340
355 TEST_F(NotificationViewTest, TestLineLimits) { 341 TEST_F(NotificationViewTest, TestLineLimits) {
356 notification()->set_image(CreateTestImage(0, 0)); 342 notification()->set_image(CreateTestImage(0, 0));
357 notification()->set_context_message(base::ASCIIToUTF16("")); 343 notification()->set_context_message(base::ASCIIToUTF16(""));
358 notification_view()->UpdateWithNotification(*notification()); 344 notification_view()->CreateOrUpdateViews(*notification());
359 345
360 EXPECT_EQ(5, notification_view()->GetMessageLineLimit(0, 360)); 346 EXPECT_EQ(5, notification_view()->GetMessageLineLimit(0, 360));
361 EXPECT_EQ(5, notification_view()->GetMessageLineLimit(1, 360)); 347 EXPECT_EQ(5, notification_view()->GetMessageLineLimit(1, 360));
362 EXPECT_EQ(3, notification_view()->GetMessageLineLimit(2, 360)); 348 EXPECT_EQ(3, notification_view()->GetMessageLineLimit(2, 360));
363 349
364 notification()->set_image(CreateTestImage(2, 2)); 350 notification()->set_image(CreateTestImage(2, 2));
365 notification_view()->UpdateWithNotification(*notification()); 351 notification_view()->CreateOrUpdateViews(*notification());
366 352
367 EXPECT_EQ(2, notification_view()->GetMessageLineLimit(0, 360)); 353 EXPECT_EQ(2, notification_view()->GetMessageLineLimit(0, 360));
368 EXPECT_EQ(2, notification_view()->GetMessageLineLimit(1, 360)); 354 EXPECT_EQ(2, notification_view()->GetMessageLineLimit(1, 360));
369 EXPECT_EQ(1, notification_view()->GetMessageLineLimit(2, 360)); 355 EXPECT_EQ(1, notification_view()->GetMessageLineLimit(2, 360));
370 356
371 notification()->set_context_message(base::ASCIIToUTF16("foo")); 357 notification()->set_context_message(base::ASCIIToUTF16("foo"));
372 notification_view()->UpdateWithNotification(*notification()); 358 notification_view()->CreateOrUpdateViews(*notification());
373 359
374 EXPECT_TRUE(notification_view()->context_message_view_ != NULL); 360 EXPECT_TRUE(notification_view()->context_message_view_ != NULL);
375 361
376 EXPECT_EQ(1, notification_view()->GetMessageLineLimit(0, 360)); 362 EXPECT_EQ(1, notification_view()->GetMessageLineLimit(0, 360));
377 EXPECT_EQ(1, notification_view()->GetMessageLineLimit(1, 360)); 363 EXPECT_EQ(1, notification_view()->GetMessageLineLimit(1, 360));
378 EXPECT_EQ(0, notification_view()->GetMessageLineLimit(2, 360)); 364 EXPECT_EQ(0, notification_view()->GetMessageLineLimit(2, 360));
379 } 365 }
380 366
381 TEST_F(NotificationViewTest, TestIconSizing) { 367 TEST_F(NotificationViewTest, TestIconSizing) {
382 notification()->set_type(NOTIFICATION_TYPE_SIMPLE); 368 notification()->set_type(NOTIFICATION_TYPE_SIMPLE);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 paint_size = GetImagePaintSize(view); 441 paint_size = GetImagePaintSize(view);
456 EXPECT_EQ(GetImageSizeForContainerSize(container_size, orig_size).ToString(), 442 EXPECT_EQ(GetImageSizeForContainerSize(container_size, orig_size).ToString(),
457 paint_size.ToString()); 443 paint_size.ToString());
458 ASSERT_GT(paint_size.height(), 0); 444 ASSERT_GT(paint_size.height(), 0);
459 EXPECT_EQ(orig_size.width() / orig_size.height(), 445 EXPECT_EQ(orig_size.width() / orig_size.height(),
460 paint_size.width() / paint_size.height()); 446 paint_size.width() / paint_size.height());
461 } 447 }
462 448
463 TEST_F(NotificationViewTest, UpdateButtonsStateTest) { 449 TEST_F(NotificationViewTest, UpdateButtonsStateTest) {
464 notification()->set_buttons(CreateButtons(2)); 450 notification()->set_buttons(CreateButtons(2));
465 notification_view()->UpdateWithNotification(*notification()); 451 notification_view()->CreateOrUpdateViews(*notification());
466 widget()->Show(); 452 widget()->Show();
467 453
468 EXPECT_EQ(views::CustomButton::STATE_NORMAL, 454 EXPECT_EQ(views::CustomButton::STATE_NORMAL,
469 notification_view()->action_buttons_[0]->state()); 455 notification_view()->action_buttons_[0]->state());
470 456
471 // Now construct a mouse move event 1 pixel inside the boundary of the action 457 // Now construct a mouse move event 1 pixel inside the boundary of the action
472 // button. 458 // button.
473 gfx::Point cursor_location(1, 1); 459 gfx::Point cursor_location(1, 1);
474 views::View::ConvertPointToWidget(notification_view()->action_buttons_[0], 460 views::View::ConvertPointToWidget(notification_view()->action_buttons_[0],
475 &cursor_location); 461 &cursor_location);
476 ui::MouseEvent move(ui::ET_MOUSE_MOVED, cursor_location, cursor_location, 462 ui::MouseEvent move(ui::ET_MOUSE_MOVED, cursor_location, cursor_location,
477 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); 463 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
478 widget()->OnMouseEvent(&move); 464 widget()->OnMouseEvent(&move);
479 465
480 EXPECT_EQ(views::CustomButton::STATE_HOVERED, 466 EXPECT_EQ(views::CustomButton::STATE_HOVERED,
481 notification_view()->action_buttons_[0]->state()); 467 notification_view()->action_buttons_[0]->state());
482 468
483 notification_view()->UpdateWithNotification(*notification()); 469 notification_view()->CreateOrUpdateViews(*notification());
484 470
485 EXPECT_EQ(views::CustomButton::STATE_HOVERED, 471 EXPECT_EQ(views::CustomButton::STATE_HOVERED,
486 notification_view()->action_buttons_[0]->state()); 472 notification_view()->action_buttons_[0]->state());
487 473
488 // Now construct a mouse move event 1 pixel outside the boundary of the 474 // Now construct a mouse move event 1 pixel outside the boundary of the
489 // widget. 475 // widget.
490 cursor_location = gfx::Point(-1, -1); 476 cursor_location = gfx::Point(-1, -1);
491 move = ui::MouseEvent(ui::ET_MOUSE_MOVED, cursor_location, cursor_location, 477 move = ui::MouseEvent(ui::ET_MOUSE_MOVED, cursor_location, cursor_location,
492 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); 478 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
493 widget()->OnMouseEvent(&move); 479 widget()->OnMouseEvent(&move);
494 480
495 EXPECT_EQ(views::CustomButton::STATE_NORMAL, 481 EXPECT_EQ(views::CustomButton::STATE_NORMAL,
496 notification_view()->action_buttons_[0]->state()); 482 notification_view()->action_buttons_[0]->state());
497 } 483 }
498 484
499 TEST_F(NotificationViewTest, UpdateButtonCountTest) { 485 TEST_F(NotificationViewTest, UpdateButtonCountTest) {
500 notification()->set_buttons(CreateButtons(2)); 486 notification()->set_buttons(CreateButtons(2));
501 notification_view()->UpdateWithNotification(*notification()); 487 notification_view()->CreateOrUpdateViews(*notification());
502 widget()->Show(); 488 widget()->Show();
503 489
504 EXPECT_EQ(views::CustomButton::STATE_NORMAL, 490 EXPECT_EQ(views::CustomButton::STATE_NORMAL,
505 notification_view()->action_buttons_[0]->state()); 491 notification_view()->action_buttons_[0]->state());
506 EXPECT_EQ(views::CustomButton::STATE_NORMAL, 492 EXPECT_EQ(views::CustomButton::STATE_NORMAL,
507 notification_view()->action_buttons_[1]->state()); 493 notification_view()->action_buttons_[1]->state());
508 494
509 // Now construct a mouse move event 1 pixel inside the boundary of the action 495 // Now construct a mouse move event 1 pixel inside the boundary of the action
510 // button. 496 // button.
511 gfx::Point cursor_location(1, 1); 497 gfx::Point cursor_location(1, 1);
512 views::View::ConvertPointToScreen(notification_view()->action_buttons_[0], 498 views::View::ConvertPointToScreen(notification_view()->action_buttons_[0],
513 &cursor_location); 499 &cursor_location);
514 ui::MouseEvent move(ui::ET_MOUSE_MOVED, cursor_location, cursor_location, 500 ui::MouseEvent move(ui::ET_MOUSE_MOVED, cursor_location, cursor_location,
515 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); 501 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
516 ui::EventDispatchDetails details = 502 ui::EventDispatchDetails details =
517 views::test::WidgetTest::GetEventSink(widget())->OnEventFromSource(&move); 503 views::test::WidgetTest::GetEventSink(widget())->OnEventFromSource(&move);
518 EXPECT_FALSE(details.dispatcher_destroyed); 504 EXPECT_FALSE(details.dispatcher_destroyed);
519 505
520 EXPECT_EQ(views::CustomButton::STATE_HOVERED, 506 EXPECT_EQ(views::CustomButton::STATE_HOVERED,
521 notification_view()->action_buttons_[0]->state()); 507 notification_view()->action_buttons_[0]->state());
522 EXPECT_EQ(views::CustomButton::STATE_NORMAL, 508 EXPECT_EQ(views::CustomButton::STATE_NORMAL,
523 notification_view()->action_buttons_[1]->state()); 509 notification_view()->action_buttons_[1]->state());
524 510
525 notification()->set_buttons(CreateButtons(1)); 511 notification()->set_buttons(CreateButtons(1));
526 notification_view()->UpdateWithNotification(*notification()); 512 notification_view()->CreateOrUpdateViews(*notification());
527 513
528 EXPECT_EQ(views::CustomButton::STATE_HOVERED, 514 EXPECT_EQ(views::CustomButton::STATE_HOVERED,
529 notification_view()->action_buttons_[0]->state()); 515 notification_view()->action_buttons_[0]->state());
530 EXPECT_EQ(1u, notification_view()->action_buttons_.size()); 516 EXPECT_EQ(1u, notification_view()->action_buttons_.size());
531 517
532 // Now construct a mouse move event 1 pixel outside the boundary of the 518 // Now construct a mouse move event 1 pixel outside the boundary of the
533 // widget. 519 // widget.
534 cursor_location = gfx::Point(-1, -1); 520 cursor_location = gfx::Point(-1, -1);
535 move = ui::MouseEvent(ui::ET_MOUSE_MOVED, cursor_location, cursor_location, 521 move = ui::MouseEvent(ui::ET_MOUSE_MOVED, cursor_location, cursor_location,
536 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); 522 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
537 widget()->OnMouseEvent(&move); 523 widget()->OnMouseEvent(&move);
538 524
539 EXPECT_EQ(views::CustomButton::STATE_NORMAL, 525 EXPECT_EQ(views::CustomButton::STATE_NORMAL,
540 notification_view()->action_buttons_[0]->state()); 526 notification_view()->action_buttons_[0]->state());
541 } 527 }
542 528
543 TEST_F(NotificationViewTest, SettingsButtonTest) { 529 TEST_F(NotificationViewTest, SettingsButtonTest) {
544 scoped_refptr<NotificationSettingsDelegate> delegate = 530 scoped_refptr<NotificationSettingsDelegate> delegate =
545 new NotificationSettingsDelegate(); 531 new NotificationSettingsDelegate();
546 Notification notf(NOTIFICATION_TYPE_BASE_FORMAT, 532 Notification notf(NOTIFICATION_TYPE_BASE_FORMAT,
547 std::string("notification id"), base::UTF8ToUTF16("title"), 533 std::string("notification id"), base::UTF8ToUTF16("title"),
548 base::UTF8ToUTF16("message"), CreateTestImage(80, 80), 534 base::UTF8ToUTF16("message"), CreateTestImage(80, 80),
549 base::UTF8ToUTF16("display source"), 535 base::UTF8ToUTF16("display source"),
550 GURL("https://hello.com"), 536 GURL("https://hello.com"),
551 NotifierId(NotifierId::APPLICATION, "extension_id"), 537 NotifierId(NotifierId::APPLICATION, "extension_id"),
552 *data(), delegate.get()); 538 *data(), delegate.get());
553 notification_view()->UpdateWithNotification(notf); 539 notification_view()->CreateOrUpdateViews(notf);
554 widget()->Show(); 540 widget()->Show();
541 notification_view()->Layout();
555 542
556 EXPECT_TRUE(NULL != GetSettingsButton()); 543 EXPECT_TRUE(NULL != notification_view()->settings_button_view_);
557 EXPECT_EQ(views::CustomButton::STATE_NORMAL, GetSettingsButton()->state()); 544 EXPECT_EQ(views::CustomButton::STATE_NORMAL,
545 notification_view()->settings_button_view_->state());
558 546
559 // Now construct a mouse move event 1 pixel inside the boundary of the action 547 // Now construct a mouse move event 1 pixel inside the boundary of the action
560 // button. 548 // button.
561 gfx::Point cursor_location(1, 1); 549 gfx::Point cursor_location(1, 1);
562 views::View::ConvertPointToScreen(GetSettingsButton(), &cursor_location); 550 views::View::ConvertPointToScreen(notification_view()->settings_button_view_,
551 &cursor_location);
563 ui::MouseEvent move(ui::ET_MOUSE_MOVED, cursor_location, cursor_location, 552 ui::MouseEvent move(ui::ET_MOUSE_MOVED, cursor_location, cursor_location,
564 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); 553 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
565 widget()->OnMouseEvent(&move); 554 widget()->OnMouseEvent(&move);
566 ui::EventDispatchDetails details = 555 ui::EventDispatchDetails details =
567 views::test::WidgetTest::GetEventSink(widget())->OnEventFromSource(&move); 556 views::test::WidgetTest::GetEventSink(widget())->OnEventFromSource(&move);
568 EXPECT_FALSE(details.dispatcher_destroyed); 557 EXPECT_FALSE(details.dispatcher_destroyed);
569 558
570 EXPECT_EQ(views::CustomButton::STATE_HOVERED, GetSettingsButton()->state()); 559 EXPECT_EQ(views::CustomButton::STATE_HOVERED,
560 notification_view()->settings_button_view_->state());
571 561
572 // Now construct a mouse move event 1 pixel outside the boundary of the 562 // Now construct a mouse move event 1 pixel outside the boundary of the
573 // widget. 563 // widget.
574 cursor_location = gfx::Point(-1, -1); 564 cursor_location = gfx::Point(-1, -1);
575 move = ui::MouseEvent(ui::ET_MOUSE_MOVED, cursor_location, cursor_location, 565 move = ui::MouseEvent(ui::ET_MOUSE_MOVED, cursor_location, cursor_location,
576 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); 566 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
577 widget()->OnMouseEvent(&move); 567 widget()->OnMouseEvent(&move);
578 568
579 EXPECT_EQ(views::CustomButton::STATE_NORMAL, GetSettingsButton()->state()); 569 EXPECT_EQ(views::CustomButton::STATE_NORMAL,
570 notification_view()->settings_button_view_->state());
580 } 571 }
581 572
582 TEST_F(NotificationViewTest, ViewOrderingTest) { 573 TEST_F(NotificationViewTest, ViewOrderingTest) {
583 // Tests that views are created in the correct vertical order. 574 // Tests that views are created in the correct vertical order.
584 notification()->set_buttons(CreateButtons(2)); 575 notification()->set_buttons(CreateButtons(2));
585 576
586 // Layout the initial views. 577 // Layout the initial views.
587 UpdateNotificationViews(); 578 UpdateNotificationViews();
588 579
589 // Double-check that vertical order is correct. 580 // Double-check that vertical order is correct.
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 TEST_F(NotificationViewTest, Pinned) { 727 TEST_F(NotificationViewTest, Pinned) {
737 notification()->set_pinned(true); 728 notification()->set_pinned(true);
738 729
739 UpdateNotificationViews(); 730 UpdateNotificationViews();
740 EXPECT_EQ(NULL, GetCloseButton()); 731 EXPECT_EQ(NULL, GetCloseButton());
741 } 732 }
742 733
743 #endif // defined(OS_CHROMEOS) 734 #endif // defined(OS_CHROMEOS)
744 735
745 } // namespace message_center 736 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/message_center/views/notification_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698