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

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

Issue 4188008: Use make_scoped_refptr for NewRunnableMethod if the raw ptr type is derivd from RefCountedThreadSafe (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: address comment Created 10 years, 1 month 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/importer/importer_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_notification_service.h" 5 #include "chrome/browser/notifications/desktop_notification_service.h"
6 6
7 #include "base/ref_counted.h" 7 #include "base/ref_counted.h"
8 #include "base/waitable_event.h" 8 #include "base/waitable_event.h"
9 #include "chrome/browser/notifications/notifications_prefs_cache.h" 9 #include "chrome/browser/notifications/notifications_prefs_cache.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
(...skipping 24 matching lines...) Expand all
35 io_thread_->Start(); 35 io_thread_->Start();
36 36
37 // Calling PauseIOThread() here isn't safe, because the runnable method 37 // Calling PauseIOThread() here isn't safe, because the runnable method
38 // could complete before the constructor is done, deleting |this|. 38 // could complete before the constructor is done, deleting |this|.
39 } 39 }
40 40
41 int CacheHasPermission(NotificationsPrefsCache* cache, const GURL& url) { 41 int CacheHasPermission(NotificationsPrefsCache* cache, const GURL& url) {
42 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 42 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
43 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 43 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
44 NewRunnableMethod(this, &ThreadProxy::CacheHasPermissionIO, 44 NewRunnableMethod(this, &ThreadProxy::CacheHasPermissionIO,
45 cache, url)); 45 make_scoped_refptr(cache), url));
46 io_event_.Signal(); 46 io_event_.Signal();
47 ui_event_.Wait(); // Wait for IO thread to be done. 47 ui_event_.Wait(); // Wait for IO thread to be done.
48 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 48 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
49 NewRunnableMethod(this, &ThreadProxy::PauseIOThreadIO)); 49 NewRunnableMethod(this, &ThreadProxy::PauseIOThreadIO));
50 50
51 return permission_; 51 return permission_;
52 } 52 }
53 53
54 void PauseIOThread() { 54 void PauseIOThread() {
55 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 55 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 EXPECT_EQ(WebKit::WebNotificationPresenter::PermissionDenied, 238 EXPECT_EQ(WebKit::WebNotificationPresenter::PermissionDenied,
239 proxy_->CacheHasPermission(cache_, denied_url)); 239 proxy_->CacheHasPermission(cache_, denied_url));
240 240
241 service_->ResetBlockedOrigin(denied_url); 241 service_->ResetBlockedOrigin(denied_url);
242 242
243 EXPECT_EQ(WebKit::WebNotificationPresenter::PermissionNotAllowed, 243 EXPECT_EQ(WebKit::WebNotificationPresenter::PermissionNotAllowed,
244 proxy_->CacheHasPermission(cache_, denied_url)); 244 proxy_->CacheHasPermission(cache_, denied_url));
245 } 245 }
246 246
247 } // namespace 247 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/importer/importer_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698