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

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

Issue 267363008: Drop non-standard user gesture requirement from notification.requestPermission (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 6 years, 7 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 | « no previous file | chrome/test/data/notifications/notifications_request_inline.html » ('j') | 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) 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 <deque> 5 #include <deque>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 browser()->tab_strip_model()->GetActiveWebContents(), 375 browser()->tab_strip_model()->GetActiveWebContents(),
376 "window.domAutomationController.send(request());", 376 "window.domAutomationController.send(request());",
377 &result)); 377 &result));
378 EXPECT_TRUE(result); 378 EXPECT_TRUE(result);
379 379
380 InfoBarService* infobar_service = InfoBarService::FromWebContents( 380 InfoBarService* infobar_service = InfoBarService::FromWebContents(
381 browser()->tab_strip_model()->GetWebContentsAt(0)); 381 browser()->tab_strip_model()->GetWebContentsAt(0));
382 EXPECT_EQ(1U, infobar_service->infobar_count()); 382 EXPECT_EQ(1U, infobar_service->infobar_count());
383 } 383 }
384 384
385 // If this flakes, use http://crbug.com/62311.
386 IN_PROC_BROWSER_TEST_F(NotificationsTest, TestNoUserGestureInfobar) {
387 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
388
389 // Load a page which just does a request; no user gesture should result
390 // in no infobar.
391 ui_test_utils::NavigateToURL(
392 browser(),
393 embedded_test_server()->GetURL(
394 "/notifications/notifications_request_inline.html"));
395
396 InfoBarService* infobar_service = InfoBarService::FromWebContents(
397 browser()->tab_strip_model()->GetWebContentsAt(0));
398 EXPECT_EQ(0U, infobar_service->infobar_count());
399 }
400
401 IN_PROC_BROWSER_TEST_F(NotificationsTest, TestCreateSimpleNotification) { 385 IN_PROC_BROWSER_TEST_F(NotificationsTest, TestCreateSimpleNotification) {
402 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 386 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
403 387
404 // Creates a simple notification. 388 // Creates a simple notification.
405 AllowAllOrigins(); 389 AllowAllOrigins();
406 ui_test_utils::NavigateToURL(browser(), GetTestPageURL()); 390 ui_test_utils::NavigateToURL(browser(), GetTestPageURL());
407 391
408 std::string result = CreateSimpleNotification(browser(), true); 392 std::string result = CreateSimpleNotification(browser(), true);
409 EXPECT_NE("-1", result); 393 EXPECT_NE("-1", result);
410 394
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 browser(), false, "no_such_file.png", "Title2", "Body2", "chat"); 771 browser(), false, "no_such_file.png", "Title2", "Body2", "chat");
788 EXPECT_NE("-1", result); 772 EXPECT_NE("-1", result);
789 773
790 ASSERT_EQ(1, GetNotificationCount()); 774 ASSERT_EQ(1, GetNotificationCount());
791 message_center::NotificationList::Notifications notifications = 775 message_center::NotificationList::Notifications notifications =
792 message_center::MessageCenter::Get()->GetVisibleNotifications(); 776 message_center::MessageCenter::Get()->GetVisibleNotifications();
793 EXPECT_EQ(base::ASCIIToUTF16("Title2"), (*notifications.rbegin())->title()); 777 EXPECT_EQ(base::ASCIIToUTF16("Title2"), (*notifications.rbegin())->title());
794 EXPECT_EQ(base::ASCIIToUTF16("Body2"), 778 EXPECT_EQ(base::ASCIIToUTF16("Body2"),
795 (*notifications.rbegin())->message()); 779 (*notifications.rbegin())->message());
796 } 780 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/notifications/notifications_request_inline.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698