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

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

Issue 1979583003: Support notifications with custom content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@messageview-close-button
Patch Set: fix mac build, attempt 2 Created 4 years, 7 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/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "third_party/skia/include/core/SkBitmap.h" 12 #include "third_party/skia/include/core/SkBitmap.h"
13 #include "third_party/skia/include/core/SkCanvas.h" 13 #include "third_party/skia/include/core/SkCanvas.h"
14 #include "third_party/skia/include/core/SkColor.h" 14 #include "third_party/skia/include/core/SkColor.h"
15 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 15 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
16 #include "ui/events/event_processor.h" 16 #include "ui/events/event_processor.h"
17 #include "ui/events/event_utils.h" 17 #include "ui/events/event_utils.h"
18 #include "ui/gfx/canvas.h" 18 #include "ui/gfx/canvas.h"
19 #include "ui/gfx/geometry/rect.h" 19 #include "ui/gfx/geometry/rect.h"
20 #include "ui/gfx/geometry/size.h" 20 #include "ui/gfx/geometry/size.h"
21 #include "ui/gfx/image/image.h" 21 #include "ui/gfx/image/image.h"
22 #include "ui/message_center/message_center_style.h" 22 #include "ui/message_center/message_center_style.h"
23 #include "ui/message_center/notification.h" 23 #include "ui/message_center/notification.h"
24 #include "ui/message_center/notification_list.h" 24 #include "ui/message_center/notification_list.h"
25 #include "ui/message_center/notification_types.h" 25 #include "ui/message_center/notification_types.h"
26 #include "ui/message_center/views/constants.h" 26 #include "ui/message_center/views/constants.h"
27 #include "ui/message_center/views/message_center_controller.h" 27 #include "ui/message_center/views/message_center_controller.h"
28 #include "ui/message_center/views/message_view_factory.h"
28 #include "ui/message_center/views/notification_button.h" 29 #include "ui/message_center/views/notification_button.h"
29 #include "ui/message_center/views/proportional_image_view.h" 30 #include "ui/message_center/views/proportional_image_view.h"
30 #include "ui/views/controls/button/image_button.h" 31 #include "ui/views/controls/button/image_button.h"
31 #include "ui/views/layout/fill_layout.h" 32 #include "ui/views/layout/fill_layout.h"
32 #include "ui/views/test/views_test_base.h" 33 #include "ui/views/test/views_test_base.h"
33 #include "ui/views/test/widget_test.h" 34 #include "ui/views/test/widget_test.h"
34 #include "ui/views/widget/widget_delegate.h" 35 #include "ui/views/widget/widget_delegate.h"
35 36
36 namespace { 37 namespace {
37 38
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 NOTIFICATION_TYPE_BASE_FORMAT, std::string("notification id"), 222 NOTIFICATION_TYPE_BASE_FORMAT, std::string("notification id"),
222 base::UTF8ToUTF16("title"), base::UTF8ToUTF16("message"), 223 base::UTF8ToUTF16("title"), base::UTF8ToUTF16("message"),
223 CreateTestImage(80, 80), base::UTF8ToUTF16("display source"), GURL(), 224 CreateTestImage(80, 80), base::UTF8ToUTF16("display source"), GURL(),
224 NotifierId(NotifierId::APPLICATION, "extension_id"), *data_, 225 NotifierId(NotifierId::APPLICATION, "extension_id"), *data_,
225 NULL)); 226 NULL));
226 notification_->set_small_image(CreateTestImage(16, 16)); 227 notification_->set_small_image(CreateTestImage(16, 16));
227 notification_->set_image(CreateTestImage(320, 240)); 228 notification_->set_image(CreateTestImage(320, 240));
228 229
229 // Then create a new NotificationView with that single notification. 230 // Then create a new NotificationView with that single notification.
230 notification_view_.reset(static_cast<NotificationView*>( 231 notification_view_.reset(static_cast<NotificationView*>(
231 NotificationView::Create(this, *notification_, true))); 232 MessageViewFactory::Create(this, *notification_, true)));
232 notification_view_->set_owned_by_client(); 233 notification_view_->set_owned_by_client();
233 234
234 views::Widget::InitParams init_params( 235 views::Widget::InitParams init_params(
235 CreateParams(views::Widget::InitParams::TYPE_POPUP)); 236 CreateParams(views::Widget::InitParams::TYPE_POPUP));
236 views::Widget* widget = new views::Widget(); 237 views::Widget* widget = new views::Widget();
237 widget->Init(init_params); 238 widget->Init(init_params);
238 widget->SetContentsView(notification_view_.get()); 239 widget->SetContentsView(notification_view_.get());
239 widget->SetSize(notification_view_->GetPreferredSize()); 240 widget->SetSize(notification_view_->GetPreferredSize());
240 } 241 }
241 242
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 TEST_F(NotificationViewTest, Pinned) { 701 TEST_F(NotificationViewTest, Pinned) {
701 notification()->set_pinned(true); 702 notification()->set_pinned(true);
702 703
703 UpdateNotificationViews(); 704 UpdateNotificationViews();
704 EXPECT_EQ(NULL, GetCloseButton()); 705 EXPECT_EQ(NULL, GetCloseButton());
705 } 706 }
706 707
707 #endif // defined(OS_CHROMEOS) 708 #endif // defined(OS_CHROMEOS)
708 709
709 } // namespace message_center 710 } // 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