| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/notifications/desktop_notifications_unittest.h" | 5 #include "chrome/browser/notifications/desktop_notifications_unittest.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 | 9 |
| 10 // static | 10 // static |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 profile_.reset(new TestingProfile()); | 75 profile_.reset(new TestingProfile()); |
| 76 balloon_collection_ = new MockBalloonCollection(); | 76 balloon_collection_ = new MockBalloonCollection(); |
| 77 ui_manager_.reset(new NotificationUIManager()); | 77 ui_manager_.reset(new NotificationUIManager()); |
| 78 ui_manager_->Initialize(balloon_collection_); | 78 ui_manager_->Initialize(balloon_collection_); |
| 79 balloon_collection_->set_space_change_listener(ui_manager_.get()); | 79 balloon_collection_->set_space_change_listener(ui_manager_.get()); |
| 80 service_.reset(new DesktopNotificationService(profile(), ui_manager_.get())); | 80 service_.reset(new DesktopNotificationService(profile(), ui_manager_.get())); |
| 81 log_output_.clear(); | 81 log_output_.clear(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void DesktopNotificationsTest::TearDown() { | 84 void DesktopNotificationsTest::TearDown() { |
| 85 service_.reset(NULL); |
| 85 profile_.reset(NULL); | 86 profile_.reset(NULL); |
| 86 ui_manager_.reset(NULL); | 87 ui_manager_.reset(NULL); |
| 87 service_.reset(NULL); | |
| 88 } | 88 } |
| 89 | 89 |
| 90 TEST_F(DesktopNotificationsTest, TestShow) { | 90 TEST_F(DesktopNotificationsTest, TestShow) { |
| 91 EXPECT_TRUE(service_->ShowDesktopNotificationText( | 91 EXPECT_TRUE(service_->ShowDesktopNotificationText( |
| 92 GURL("http://www.google.com"), | 92 GURL("http://www.google.com"), |
| 93 GURL("/icon.png"), ASCIIToUTF16("Title"), ASCIIToUTF16("Text"), | 93 GURL("/icon.png"), ASCIIToUTF16("Title"), ASCIIToUTF16("Text"), |
| 94 0, 0, DesktopNotificationService::PageNotification, 1)); | 94 0, 0, DesktopNotificationService::PageNotification, 1)); |
| 95 MessageLoopForUI::current()->RunAllPending(); | 95 MessageLoopForUI::current()->RunAllPending(); |
| 96 EXPECT_EQ(1, balloon_collection_->count()); | 96 EXPECT_EQ(1, balloon_collection_->count()); |
| 97 | 97 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 ASCIIToUTF16("<i>this text is in italics</i>"), | 284 ASCIIToUTF16("<i>this text is in italics</i>"), |
| 285 0, 0, DesktopNotificationService::PageNotification, 1)); | 285 0, 0, DesktopNotificationService::PageNotification, 1)); |
| 286 | 286 |
| 287 MessageLoopForUI::current()->RunAllPending(); | 287 MessageLoopForUI::current()->RunAllPending(); |
| 288 EXPECT_EQ(1, balloon_collection_->count()); | 288 EXPECT_EQ(1, balloon_collection_->count()); |
| 289 Balloon* balloon = (*balloon_collection_->balloons().begin()); | 289 Balloon* balloon = (*balloon_collection_->balloons().begin()); |
| 290 GURL data_url = balloon->notification().content_url(); | 290 GURL data_url = balloon->notification().content_url(); |
| 291 EXPECT_EQ(std::string::npos, data_url.spec().find("<script>")); | 291 EXPECT_EQ(std::string::npos, data_url.spec().find("<script>")); |
| 292 EXPECT_EQ(std::string::npos, data_url.spec().find("<i>")); | 292 EXPECT_EQ(std::string::npos, data_url.spec().find("<i>")); |
| 293 } | 293 } |
| OLD | NEW |