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

Side by Side Diff: ash/system/web_notification/web_notification_tray_unittest.cc

Issue 1867223004: Convert //ash from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/system/web_notification/web_notification_tray.h" 5 #include "ash/system/web_notification/web_notification_tray.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 ~WebNotificationTrayTest() override {} 94 ~WebNotificationTrayTest() override {}
95 95
96 void TearDown() override { 96 void TearDown() override {
97 GetMessageCenter()->RemoveAllNotifications( 97 GetMessageCenter()->RemoveAllNotifications(
98 false /* by_user */, message_center::MessageCenter::RemoveType::ALL); 98 false /* by_user */, message_center::MessageCenter::RemoveType::ALL);
99 test::AshTestBase::TearDown(); 99 test::AshTestBase::TearDown();
100 } 100 }
101 101
102 protected: 102 protected:
103 void AddNotification(const std::string& id) { 103 void AddNotification(const std::string& id) {
104 scoped_ptr<message_center::Notification> notification; 104 std::unique_ptr<message_center::Notification> notification;
105 notification.reset(new message_center::Notification( 105 notification.reset(new message_center::Notification(
106 message_center::NOTIFICATION_TYPE_SIMPLE, id, 106 message_center::NOTIFICATION_TYPE_SIMPLE, id,
107 base::ASCIIToUTF16("Test Web Notification"), 107 base::ASCIIToUTF16("Test Web Notification"),
108 base::ASCIIToUTF16("Notification message body."), gfx::Image(), 108 base::ASCIIToUTF16("Notification message body."), gfx::Image(),
109 base::ASCIIToUTF16("www.test.org"), GURL(), 109 base::ASCIIToUTF16("www.test.org"), GURL(),
110 message_center::NotifierId(), message_center::RichNotificationData(), 110 message_center::NotifierId(), message_center::RichNotificationData(),
111 NULL /* delegate */)); 111 NULL /* delegate */));
112 GetMessageCenter()->AddNotification(std::move(notification)); 112 GetMessageCenter()->AddNotification(std::move(notification));
113 } 113 }
114 114
115 void UpdateNotification(const std::string& old_id, 115 void UpdateNotification(const std::string& old_id,
116 const std::string& new_id) { 116 const std::string& new_id) {
117 scoped_ptr<message_center::Notification> notification; 117 std::unique_ptr<message_center::Notification> notification;
118 notification.reset(new message_center::Notification( 118 notification.reset(new message_center::Notification(
119 message_center::NOTIFICATION_TYPE_SIMPLE, new_id, 119 message_center::NOTIFICATION_TYPE_SIMPLE, new_id,
120 base::ASCIIToUTF16("Updated Web Notification"), 120 base::ASCIIToUTF16("Updated Web Notification"),
121 base::ASCIIToUTF16("Updated message body."), gfx::Image(), 121 base::ASCIIToUTF16("Updated message body."), gfx::Image(),
122 base::ASCIIToUTF16("www.test.org"), GURL(), 122 base::ASCIIToUTF16("www.test.org"), GURL(),
123 message_center::NotifierId(), message_center::RichNotificationData(), 123 message_center::NotifierId(), message_center::RichNotificationData(),
124 NULL /* delegate */)); 124 NULL /* delegate */));
125 GetMessageCenter()->UpdateNotification(old_id, std::move(notification)); 125 GetMessageCenter()->UpdateNotification(old_id, std::move(notification));
126 } 126 }
127 127
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 EXPECT_TRUE(GetTray()->IsPopupVisible()); 347 EXPECT_TRUE(GetTray()->IsPopupVisible());
348 EXPECT_EQ(bottom, GetPopupWorkAreaBottom()); 348 EXPECT_EQ(bottom, GetPopupWorkAreaBottom());
349 } 349 }
350 350
351 TEST_F(WebNotificationTrayTest, MAYBE_PopupAndAutoHideShelf) { 351 TEST_F(WebNotificationTrayTest, MAYBE_PopupAndAutoHideShelf) {
352 AddNotification("test_id"); 352 AddNotification("test_id");
353 EXPECT_TRUE(GetTray()->IsPopupVisible()); 353 EXPECT_TRUE(GetTray()->IsPopupVisible());
354 int bottom = GetPopupWorkAreaBottom(); 354 int bottom = GetPopupWorkAreaBottom();
355 355
356 // Shelf's auto-hide state won't be HIDDEN unless window exists. 356 // Shelf's auto-hide state won't be HIDDEN unless window exists.
357 scoped_ptr<aura::Window> window( 357 std::unique_ptr<aura::Window> window(
358 CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 3, 4))); 358 CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 3, 4)));
359 ShelfLayoutManager* shelf = 359 ShelfLayoutManager* shelf =
360 Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager(); 360 Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager();
361 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); 361 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
362 362
363 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); 363 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
364 int bottom_auto_hidden = GetPopupWorkAreaBottom(); 364 int bottom_auto_hidden = GetPopupWorkAreaBottom();
365 EXPECT_LT(bottom, bottom_auto_hidden); 365 EXPECT_LT(bottom, bottom_auto_hidden);
366 366
367 // Close the window, which shows the shelf. 367 // Close the window, which shows the shelf.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 bottom_shown_with_tray_notification); 405 bottom_shown_with_tray_notification);
406 EXPECT_GT(bottom_auto_shown, bottom_shown_with_tray_notification); 406 EXPECT_GT(bottom_auto_shown, bottom_shown_with_tray_notification);
407 } 407 }
408 408
409 TEST_F(WebNotificationTrayTest, MAYBE_PopupAndFullscreen) { 409 TEST_F(WebNotificationTrayTest, MAYBE_PopupAndFullscreen) {
410 AddNotification("test_id"); 410 AddNotification("test_id");
411 EXPECT_TRUE(IsPopupVisible()); 411 EXPECT_TRUE(IsPopupVisible());
412 int bottom = GetPopupWorkAreaBottom(); 412 int bottom = GetPopupWorkAreaBottom();
413 413
414 // Checks the work area for normal auto-hidden state. 414 // Checks the work area for normal auto-hidden state.
415 scoped_ptr<aura::Window> window( 415 std::unique_ptr<aura::Window> window(
416 CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 3, 4))); 416 CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 3, 4)));
417 ShelfLayoutManager* shelf = 417 ShelfLayoutManager* shelf =
418 Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager(); 418 Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager();
419 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); 419 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
420 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); 420 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
421 int bottom_auto_hidden = GetPopupWorkAreaBottom(); 421 int bottom_auto_hidden = GetPopupWorkAreaBottom();
422 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); 422 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
423 423
424 // Put |window| into fullscreen without forcing the shelf to hide. Currently, 424 // Put |window| into fullscreen without forcing the shelf to hide. Currently,
425 // this is used by immersive fullscreen and forces the shelf to be auto 425 // this is used by immersive fullscreen and forces the shelf to be auto
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, out_of_bounds, touch_id, 523 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, out_of_bounds, touch_id,
524 move.time_stamp()+base::TimeDelta::FromMilliseconds(50)); 524 move.time_stamp()+base::TimeDelta::FromMilliseconds(50));
525 generator.Dispatch(&release); 525 generator.Dispatch(&release);
526 EXPECT_FALSE(tray->draw_background_as_active()); 526 EXPECT_FALSE(tray->draw_background_as_active());
527 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible()); 527 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible());
528 } 528 }
529 529
530 #endif // OS_CHROMEOS 530 #endif // OS_CHROMEOS
531 531
532 } // namespace ash 532 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698