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

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

Issue 6813116: Revert 81277 - Profile shouldn't own DesktopNotificationService.DesktopNotificationService is now... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 8 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 "chrome/browser/notifications/desktop_notification_service.h" 5 #include "chrome/browser/notifications/desktop_notification_service.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "chrome/browser/notifications/desktop_notification_service_factory.h"
11 #include "chrome/browser/notifications/notifications_prefs_cache.h" 10 #include "chrome/browser/notifications/notifications_prefs_cache.h"
12 #include "chrome/browser/prefs/pref_service.h" 11 #include "chrome/browser/prefs/pref_service.h"
13 #include "chrome/browser/prefs/scoped_user_pref_update.h" 12 #include "chrome/browser/prefs/scoped_user_pref_update.h"
14 #include "chrome/common/pref_names.h" 13 #include "chrome/common/pref_names.h"
15 #include "chrome/test/testing_profile.h" 14 #include "chrome/test/testing_profile.h"
16 #include "content/browser/browser_thread.h" 15 #include "content/browser/browser_thread.h"
17 #include "content/browser/renderer_host/test_render_view_host.h" 16 #include "content/browser/renderer_host/test_render_view_host.h"
18 #include "grit/generated_resources.h" 17 #include "grit/generated_resources.h"
19 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNotificationPresen ter.h" 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNotificationPresen ter.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 DesktopNotificationServiceTest() { 95 DesktopNotificationServiceTest() {
97 } 96 }
98 97
99 virtual void SetUp() { 98 virtual void SetUp() {
100 RenderViewHostTestHarness::SetUp(); 99 RenderViewHostTestHarness::SetUp();
101 proxy_ = new ThreadProxy; 100 proxy_ = new ThreadProxy;
102 proxy_->PauseIOThread(); 101 proxy_->PauseIOThread();
103 102
104 // Creates the service, calls InitPrefs() on it which loads data from the 103 // Creates the service, calls InitPrefs() on it which loads data from the
105 // profile into the cache and then puts the cache in io thread mode. 104 // profile into the cache and then puts the cache in io thread mode.
106 service_ = DesktopNotificationServiceFactory::GetForProfile(profile()); 105 service_ = profile()->GetDesktopNotificationService();
107 cache_ = service_->prefs_cache(); 106 cache_ = service_->prefs_cache();
108 } 107 }
109 108
110 virtual void TearDown() { 109 virtual void TearDown() {
111 // The io thread's waiting on the io_event_ might hold a ref to |proxy_|, 110 // The io thread's waiting on the io_event_ might hold a ref to |proxy_|,
112 // preventing its destruction. Clear that ref. 111 // preventing its destruction. Clear that ref.
113 proxy_->DrainIOThread(); 112 proxy_->DrainIOThread();
114 RenderViewHostTestHarness::TearDown(); 113 RenderViewHostTestHarness::TearDown();
115 } 114 }
116 115
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 EXPECT_EQ(WebKit::WebNotificationPresenter::PermissionDenied, 274 EXPECT_EQ(WebKit::WebNotificationPresenter::PermissionDenied,
276 proxy_->CacheHasPermission(cache_, denied_url)); 275 proxy_->CacheHasPermission(cache_, denied_url));
277 276
278 service_->ResetBlockedOrigin(denied_url); 277 service_->ResetBlockedOrigin(denied_url);
279 278
280 EXPECT_EQ(WebKit::WebNotificationPresenter::PermissionNotAllowed, 279 EXPECT_EQ(WebKit::WebNotificationPresenter::PermissionNotAllowed,
281 proxy_->CacheHasPermission(cache_, denied_url)); 280 proxy_->CacheHasPermission(cache_, denied_url));
282 } 281 }
283 282
284 } // namespace 283 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698