diff options
author | johnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-08 19:49:56 +0000 |
---|---|---|
committer | johnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-08 19:49:56 +0000 |
commit | d42d02c4a7ea5fd8781af7a67d9ac186d0ee0db5 (patch) | |
tree | 0dea8cb5c6ee1216a0651b2dea603f0042759b06 /chrome/browser/notifications/desktop_notifications_unittest.cc | |
parent | cad4da4151f41c6203a9fe502fb818bab7e4862a (diff) | |
download | chromium_src-d42d02c4a7ea5fd8781af7a67d9ac186d0ee0db5.zip chromium_src-d42d02c4a7ea5fd8781af7a67d9ac186d0ee0db5.tar.gz chromium_src-d42d02c4a7ea5fd8781af7a67d9ac186d0ee0db5.tar.bz2 |
Notifications should resize themselves to the content within min-max bounds, rather than being all the same size.
CL hooks into RenderView callbacks to detect the size of the content, and contains some refactoring so that conceptually balloon size = content size + frame, rather than content size = balloon size - frame as it has been.
BUG=26691
TEST=included
Review URL: http://codereview.chromium.org/460131
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34076 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/notifications/desktop_notifications_unittest.cc')
-rw-r--r-- | chrome/browser/notifications/desktop_notifications_unittest.cc | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/chrome/browser/notifications/desktop_notifications_unittest.cc b/chrome/browser/notifications/desktop_notifications_unittest.cc index 8d0bcf6..32bda04 100644 --- a/chrome/browser/notifications/desktop_notifications_unittest.cc +++ b/chrome/browser/notifications/desktop_notifications_unittest.cc @@ -70,8 +70,8 @@ int MockBalloonCollection::UppermostVerticalPosition() { return min; } -DesktopNotificationsTest::DesktopNotificationsTest() : - ui_thread_(ChromeThread::UI, &message_loop_) { +DesktopNotificationsTest::DesktopNotificationsTest() + : ui_thread_(ChromeThread::UI, &message_loop_) { } DesktopNotificationsTest::~DesktopNotificationsTest() { @@ -183,6 +183,41 @@ TEST_F(DesktopNotificationsTest, TestPositioning) { EXPECT_EQ(expected_log, log_output_); } + +TEST_F(DesktopNotificationsTest, TestVariableSize) { + std::string expected_log; + // Create some toasts. After each but the first, make sure there + // is a minimum separation between the toasts. + int last_top = 0; + EXPECT_TRUE(service_->ShowDesktopNotificationText( + GURL("http://long.google.com"), GURL("/icon.png"), + ASCIIToUTF16("Really Really Really Really Really Really " + "Really Really Really Really Really Really " + "Really Really Really Really Really Really Really Long Title"), + ASCIIToUTF16("Text"), + 0, 0, DesktopNotificationService::PageNotification, 0)); + expected_log.append("notification displayed\n"); + EXPECT_TRUE(service_->ShowDesktopNotificationText( + GURL("http://short.google.com"), GURL("/icon.png"), + ASCIIToUTF16("Short title"), ASCIIToUTF16("Text"), + 0, 0, DesktopNotificationService::PageNotification, 1)); + expected_log.append("notification displayed\n"); + + std::set<Balloon*>& balloons = balloon_collection_->balloons(); + std::set<Balloon*>::iterator iter; + for (iter = balloons.begin(); iter != balloons.end(); ++iter) { + if ((*iter)->notification().origin_url().host() == "long.google.com") { + EXPECT_GE((*iter)->GetViewSize().height(), + balloon_collection_->MinHeight()); + EXPECT_LE((*iter)->GetViewSize().height(), + balloon_collection_->MaxHeight()); + } else { + EXPECT_EQ((*iter)->GetViewSize().height(), + balloon_collection_->MinHeight()); + } + } + EXPECT_EQ(expected_log, log_output_); +} #endif TEST_F(DesktopNotificationsTest, TestQueueing) { |