| OLD | NEW |
| 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "chrome/browser/notifications/balloon.h" | 7 #include "chrome/browser/notifications/balloon.h" |
| 8 #include "chrome/browser/notifications/balloon_collection.h" | 8 #include "chrome/browser/notifications/balloon_collection.h" |
| 9 #include "chrome/browser/notifications/notification.h" | 9 #include "chrome/browser/notifications/notification.h" |
| 10 #include "chrome/browser/notifications/notification_object_proxy.h" | 10 #include "chrome/browser/notifications/notification_object_proxy.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 ChromeRenderViewHostTestHarness::TearDown(); | 72 ChromeRenderViewHostTestHarness::TearDown(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 protected: | 75 protected: |
| 76 scoped_ptr<Browser> browser_; | 76 scoped_ptr<Browser> browser_; |
| 77 scoped_ptr<BalloonCollection> collection_; | 77 scoped_ptr<BalloonCollection> collection_; |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 TEST_F(BalloonControllerTest, ShowAndCloseTest) { | 80 TEST_F(BalloonControllerTest, ShowAndCloseTest) { |
| 81 Notification n(GURL("http://www.google.com"), GURL("http://www.google.com"), | 81 Notification n(GURL("http://www.google.com"), GURL("http://www.google.com"), |
| 82 ASCIIToUTF16("http://www.google.com"), base::string16(), | 82 base::ASCIIToUTF16("http://www.google.com"), base::string16(), |
| 83 new NotificationObjectProxy(-1, -1, -1, false)); | 83 new NotificationObjectProxy(-1, -1, -1, false)); |
| 84 scoped_ptr<Balloon> balloon( | 84 scoped_ptr<Balloon> balloon( |
| 85 new Balloon(n, profile(), collection_.get())); | 85 new Balloon(n, profile(), collection_.get())); |
| 86 balloon->SetPosition(gfx::Point(1, 1), false); | 86 balloon->SetPosition(gfx::Point(1, 1), false); |
| 87 balloon->set_content_size(gfx::Size(100, 100)); | 87 balloon->set_content_size(gfx::Size(100, 100)); |
| 88 | 88 |
| 89 BalloonController* controller = | 89 BalloonController* controller = |
| 90 [[TestBalloonController alloc] initWithBalloon:balloon.get()]; | 90 [[TestBalloonController alloc] initWithBalloon:balloon.get()]; |
| 91 | 91 |
| 92 [controller showWindow:nil]; | 92 [controller showWindow:nil]; |
| 93 [controller closeBalloon:YES]; | 93 [controller closeBalloon:YES]; |
| 94 } | 94 } |
| 95 | 95 |
| 96 TEST_F(BalloonControllerTest, SizesTest) { | 96 TEST_F(BalloonControllerTest, SizesTest) { |
| 97 Notification n(GURL("http://www.google.com"), GURL("http://www.google.com"), | 97 Notification n(GURL("http://www.google.com"), GURL("http://www.google.com"), |
| 98 ASCIIToUTF16("http://www.google.com"), base::string16(), | 98 base::ASCIIToUTF16("http://www.google.com"), base::string16(), |
| 99 new NotificationObjectProxy(-1, -1, -1, false)); | 99 new NotificationObjectProxy(-1, -1, -1, false)); |
| 100 scoped_ptr<Balloon> balloon( | 100 scoped_ptr<Balloon> balloon( |
| 101 new Balloon(n, profile(), collection_.get())); | 101 new Balloon(n, profile(), collection_.get())); |
| 102 balloon->SetPosition(gfx::Point(1, 1), false); | 102 balloon->SetPosition(gfx::Point(1, 1), false); |
| 103 balloon->set_content_size(gfx::Size(100, 100)); | 103 balloon->set_content_size(gfx::Size(100, 100)); |
| 104 | 104 |
| 105 BalloonController* controller = | 105 BalloonController* controller = |
| 106 [[TestBalloonController alloc] initWithBalloon:balloon.get()]; | 106 [[TestBalloonController alloc] initWithBalloon:balloon.get()]; |
| 107 | 107 |
| 108 [controller showWindow:nil]; | 108 [controller showWindow:nil]; |
| 109 | 109 |
| 110 EXPECT_TRUE([controller desiredTotalWidth] > 100); | 110 EXPECT_TRUE([controller desiredTotalWidth] > 100); |
| 111 EXPECT_TRUE([controller desiredTotalHeight] > 100); | 111 EXPECT_TRUE([controller desiredTotalHeight] > 100); |
| 112 | 112 |
| 113 [controller closeBalloon:YES]; | 113 [controller closeBalloon:YES]; |
| 114 } | 114 } |
| 115 | 115 |
| 116 } | 116 } |
| OLD | NEW |