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

Side by Side Diff: chrome/browser/notifications/desktop_notifications_unittest.cc

Issue 2903011: Fix valgrind failure in notifications tests. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/notifications/desktop_notifications_unittest.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 (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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 ViewHostMsg_ShowNotification_Params 92 ViewHostMsg_ShowNotification_Params
93 DesktopNotificationsTest::StandardTestNotification() { 93 DesktopNotificationsTest::StandardTestNotification() {
94 ViewHostMsg_ShowNotification_Params params; 94 ViewHostMsg_ShowNotification_Params params;
95 params.notification_id = 0; 95 params.notification_id = 0;
96 params.origin = GURL("http://www.google.com"); 96 params.origin = GURL("http://www.google.com");
97 params.is_html = false; 97 params.is_html = false;
98 params.icon_url = GURL("/icon.png"); 98 params.icon_url = GURL("/icon.png");
99 params.title = ASCIIToUTF16("Title"); 99 params.title = ASCIIToUTF16("Title");
100 params.body = ASCIIToUTF16("Text"); 100 params.body = ASCIIToUTF16("Text");
101 params.direction = WebKit::WebTextDirectionDefault;
101 return params; 102 return params;
102 } 103 }
103 104
104 TEST_F(DesktopNotificationsTest, TestShow) { 105 TEST_F(DesktopNotificationsTest, TestShow) {
105 ViewHostMsg_ShowNotification_Params params = StandardTestNotification(); 106 ViewHostMsg_ShowNotification_Params params = StandardTestNotification();
106 params.notification_id = 1; 107 params.notification_id = 1;
107 108
108 EXPECT_TRUE(service_->ShowDesktopNotification( 109 EXPECT_TRUE(service_->ShowDesktopNotification(
109 params, 0, 0, DesktopNotificationService::PageNotification)); 110 params, 0, 0, DesktopNotificationService::PageNotification));
110 MessageLoopForUI::current()->RunAllPending(); 111 MessageLoopForUI::current()->RunAllPending();
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 MessageLoopForUI::current()->RunAllPending(); 318 MessageLoopForUI::current()->RunAllPending();
318 EXPECT_EQ(1, balloon_collection_->count()); 319 EXPECT_EQ(1, balloon_collection_->count());
319 Balloon* balloon = (*balloon_collection_->balloons().begin()); 320 Balloon* balloon = (*balloon_collection_->balloons().begin());
320 GURL data_url = balloon->notification().content_url(); 321 GURL data_url = balloon->notification().content_url();
321 EXPECT_EQ(std::string::npos, data_url.spec().find("<script>")); 322 EXPECT_EQ(std::string::npos, data_url.spec().find("<script>"));
322 EXPECT_EQ(std::string::npos, data_url.spec().find("<i>")); 323 EXPECT_EQ(std::string::npos, data_url.spec().find("<i>"));
323 // URL-encoded versions of tags should also not be found. 324 // URL-encoded versions of tags should also not be found.
324 EXPECT_EQ(std::string::npos, data_url.spec().find("%3cscript%3e")); 325 EXPECT_EQ(std::string::npos, data_url.spec().find("%3cscript%3e"));
325 EXPECT_EQ(std::string::npos, data_url.spec().find("%3ci%3e")); 326 EXPECT_EQ(std::string::npos, data_url.spec().find("%3ci%3e"));
326 } 327 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/notifications/desktop_notifications_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698