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

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

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ref_counted.h" 5 #include "base/memory/ref_counted.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/string16.h" 8 #include "base/string16.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/chromeos/notifications/balloon_collection_impl.h" 13 #include "chrome/browser/chromeos/notifications/balloon_collection_impl.h"
14 #include "chrome/browser/chromeos/notifications/balloon_view.h" 14 #include "chrome/browser/chromeos/notifications/balloon_view.h"
15 #include "chrome/browser/chromeos/notifications/notification_panel.h" 15 #include "chrome/browser/chromeos/notifications/notification_panel.h"
16 #include "chrome/browser/chromeos/notifications/system_notification_factory.h" 16 #include "chrome/browser/chromeos/notifications/system_notification_factory.h"
17 #include "chrome/browser/notifications/notification_test_util.h" 17 #include "chrome/browser/notifications/notification_test_util.h"
18 #include "chrome/browser/notifications/notification_ui_manager.h" 18 #include "chrome/browser/notifications/notification_ui_manager.h"
19 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
20 #include "chrome/common/chrome_notification_types.h" 20 #include "chrome/common/chrome_notification_types.h"
21 #include "chrome/test/base/in_process_browser_test.h" 21 #include "chrome/test/base/in_process_browser_test.h"
22 #include "chrome/test/base/ui_test_utils.h" 22 #include "chrome/test/base/ui_test_utils.h"
23 #include "content/common/notification_service.h" 23 #include "content/public/browser/notification_service.h"
24 #include "ui/base/x/x11_util.h" 24 #include "ui/base/x/x11_util.h"
25 25
26 namespace { 26 namespace {
27 27
28 // The name of ChromeOS's window manager. 28 // The name of ChromeOS's window manager.
29 const char* kChromeOsWindowManagerName = "chromeos-wm"; 29 const char* kChromeOsWindowManagerName = "chromeos-wm";
30 30
31 } // namespace 31 } // namespace
32 32
33 namespace chromeos { 33 namespace chromeos {
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 // [MINIMIZED] -remove-> [CLOSED] 297 // [MINIMIZED] -remove-> [CLOSED]
298 // 298 //
299 // This test depends on the fact that the panel state change occurs 299 // This test depends on the fact that the panel state change occurs
300 // quicker than stale timeout, thus the stale timeout cannot be set to 300 // quicker than stale timeout, thus the stale timeout cannot be set to
301 // 0. This test explicitly controls the stale state instead. 301 // 0. This test explicitly controls the stale state instead.
302 IN_PROC_BROWSER_TEST_F(NotificationTest, TestStateTransition2) { 302 IN_PROC_BROWSER_TEST_F(NotificationTest, TestStateTransition2) {
303 // Register observer here as the registration does not work in SetUp(). 303 // Register observer here as the registration does not work in SetUp().
304 content::NotificationRegistrar registrar; 304 content::NotificationRegistrar registrar;
305 registrar.Add(this, 305 registrar.Add(this,
306 chrome::NOTIFICATION_PANEL_STATE_CHANGED, 306 chrome::NOTIFICATION_PANEL_STATE_CHANGED,
307 NotificationService::AllSources()); 307 content::NotificationService::AllSources());
308 308
309 BalloonCollectionImpl* collection = GetBalloonCollectionImpl(); 309 BalloonCollectionImpl* collection = GetBalloonCollectionImpl();
310 NotificationPanel* panel = GetNotificationPanel(); 310 NotificationPanel* panel = GetNotificationPanel();
311 NotificationPanelTester* tester = panel->GetTester(); 311 NotificationPanelTester* tester = panel->GetTester();
312 312
313 // See description above. 313 // See description above.
314 tester->SetStaleTimeout(100000); 314 tester->SetStaleTimeout(100000);
315 315
316 EXPECT_EQ(NotificationPanel::CLOSED, tester->state()); 316 EXPECT_EQ(NotificationPanel::CLOSED, tester->state());
317 317
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 EXPECT_EQ(0, tester->GetNotificationCount()); 364 EXPECT_EQ(0, tester->GetNotificationCount());
365 EXPECT_EQ(NotificationPanel::CLOSED, tester->state()); 365 EXPECT_EQ(NotificationPanel::CLOSED, tester->state());
366 366
367 ui_test_utils::RunAllPendingInMessageLoop(); 367 ui_test_utils::RunAllPendingInMessageLoop();
368 } 368 }
369 369
370 IN_PROC_BROWSER_TEST_F(NotificationTest, TestCleanupOnExit) { 370 IN_PROC_BROWSER_TEST_F(NotificationTest, TestCleanupOnExit) {
371 content::NotificationRegistrar registrar; 371 content::NotificationRegistrar registrar;
372 registrar.Add(this, 372 registrar.Add(this,
373 chrome::NOTIFICATION_PANEL_STATE_CHANGED, 373 chrome::NOTIFICATION_PANEL_STATE_CHANGED,
374 NotificationService::AllSources()); 374 content::NotificationService::AllSources());
375 375
376 BalloonCollectionImpl* collection = GetBalloonCollectionImpl(); 376 BalloonCollectionImpl* collection = GetBalloonCollectionImpl();
377 NotificationPanel* panel = GetNotificationPanel(); 377 NotificationPanel* panel = GetNotificationPanel();
378 NotificationPanelTester* tester = panel->GetTester(); 378 NotificationPanelTester* tester = panel->GetTester();
379 379
380 // Don't become stale. 380 // Don't become stale.
381 tester->SetStaleTimeout(100000); 381 tester->SetStaleTimeout(100000);
382 382
383 collection->Add(NewMockNotification("1"), browser()->profile()); 383 collection->Add(NewMockNotification("1"), browser()->profile());
384 EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state()); 384 EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state());
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 EXPECT_TRUE(collection->AddWebUIMessageCallback( 597 EXPECT_TRUE(collection->AddWebUIMessageCallback(
598 NewMockNotification("1"), 598 NewMockNotification("1"),
599 "test", 599 "test",
600 NewCallback( 600 NewCallback(
601 static_cast<NotificationTest*>(this), 601 static_cast<NotificationTest*>(this),
602 &NotificationTest::HandleWebUIMessage))); 602 &NotificationTest::HandleWebUIMessage)));
603 MessageLoop::current()->Run(); 603 MessageLoop::current()->Run();
604 } 604 }
605 605
606 } // namespace chromeos 606 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/notifications/balloon_collection_impl.cc ('k') | chrome/browser/chromeos/offline/offline_load_page.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698