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

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

Issue 2075953003: mash: Convert WebNotificationTray to wm common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@statusarea
Patch Set: rebase Created 4 years, 6 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
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 "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 28 matching lines...) Expand all
39 std::string text) { 39 std::string text) {
40 return base::WrapUnique(new message_center::Notification( 40 return base::WrapUnique(new message_center::Notification(
41 message_center::NOTIFICATION_TYPE_BASE_FORMAT, id, 41 message_center::NOTIFICATION_TYPE_BASE_FORMAT, id,
42 base::UTF8ToUTF16("test title"), base::ASCIIToUTF16(text), gfx::Image(), 42 base::UTF8ToUTF16("test title"), base::ASCIIToUTF16(text), gfx::Image(),
43 base::string16() /* display_source */, GURL(), 43 base::string16() /* display_source */, GURL(),
44 message_center::NotifierId(message_center::NotifierId::APPLICATION, id), 44 message_center::NotifierId(message_center::NotifierId::APPLICATION, id),
45 message_center::RichNotificationData(), 45 message_center::RichNotificationData(),
46 new message_center::NotificationDelegate())); 46 new message_center::NotificationDelegate()));
47 } 47 }
48 48
49 // Provides an aura window context for widget creation.
50 class TestPopupAlignmentDelegate
51 : public message_center::DesktopPopupAlignmentDelegate {
52 public:
53 explicit TestPopupAlignmentDelegate(gfx::NativeWindow context)
54 : context_(context) {}
55 ~TestPopupAlignmentDelegate() override {}
56
57 // PopupAlignmentDelegate:
58 void ConfigureWidgetInitParamsForContainer(
59 views::Widget* widget,
60 views::Widget::InitParams* init_params) override {
61 init_params->context = context_;
62 }
63
64 private:
65 gfx::NativeWindow context_;
66
67 DISALLOW_COPY_AND_ASSIGN(TestPopupAlignmentDelegate);
68 };
69
49 } // namespace 70 } // namespace
50 71
51 namespace message_center { 72 namespace message_center {
52 namespace test { 73 namespace test {
53 74
54 class MessagePopupCollectionTest : public views::ViewsTestBase { 75 class MessagePopupCollectionTest : public views::ViewsTestBase {
55 public: 76 public:
56 void SetUp() override { 77 void SetUp() override {
57 views::ViewsTestBase::SetUp(); 78 views::ViewsTestBase::SetUp();
58 MessageCenter::Initialize(); 79 MessageCenter::Initialize();
59 MessageCenter::Get()->DisableTimersForTest(); 80 MessageCenter::Get()->DisableTimersForTest();
60 alignment_delegate_.reset(new DesktopPopupAlignmentDelegate); 81 alignment_delegate_.reset(new TestPopupAlignmentDelegate(GetContext()));
61 collection_.reset(new MessagePopupCollection( 82 collection_.reset(new MessagePopupCollection(MessageCenter::Get(), NULL,
62 GetContext(), MessageCenter::Get(), NULL, alignment_delegate_.get())); 83 alignment_delegate_.get()));
63 // This size fits test machines resolution and also can keep a few toasts 84 // This size fits test machines resolution and also can keep a few toasts
64 // w/o ill effects of hitting the screen overflow. This allows us to assume 85 // w/o ill effects of hitting the screen overflow. This allows us to assume
65 // and verify normal layout of the toast stack. 86 // and verify normal layout of the toast stack.
66 SetDisplayInfo(gfx::Rect(0, 0, 600, 390), // taskbar at the bottom. 87 SetDisplayInfo(gfx::Rect(0, 0, 600, 390), // taskbar at the bottom.
67 gfx::Rect(0, 0, 600, 400)); 88 gfx::Rect(0, 0, 600, 400));
68 id_ = 0; 89 id_ = 0;
69 PrepareForWait(); 90 PrepareForWait();
70 } 91 }
71 92
72 void TearDown() override { 93 void TearDown() override {
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 << *checked_animation.error_msg(); 742 << *checked_animation.error_msg();
722 } 743 }
723 } 744 }
724 745
725 CloseAllToasts(); 746 CloseAllToasts();
726 WaitForTransitionsDone(); 747 WaitForTransitionsDone();
727 } 748 }
728 749
729 } // namespace test 750 } // namespace test
730 } // namespace message_center 751 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/message_center/views/message_popup_collection.cc ('k') | ui/message_center/views/popup_alignment_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698