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

Unified Diff: chrome/browser/notifications/desktop_notification_service_unittest.cc

Issue 2800041: Attempted build fix: Run IO blocking task actually on IO thread. (Closed)
Patch Set: Created 10 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/notifications/desktop_notification_service_unittest.cc
diff --git a/chrome/browser/notifications/desktop_notification_service_unittest.cc b/chrome/browser/notifications/desktop_notification_service_unittest.cc
index 27ceb8cf98754a62beae357ee9b0cf2d910c1e5f..4e0a705e2a8df7c761cec19474e8095311325efe 100644
--- a/chrome/browser/notifications/desktop_notification_service_unittest.cc
+++ b/chrome/browser/notifications/desktop_notification_service_unittest.cc
@@ -12,19 +12,28 @@
#include "grit/generated_resources.h"
#include "testing/gtest/include/gtest/gtest.h"
-class DesktopNotificationServiceTest : public RenderViewHostTestHarness {
+namespace {
+
+class WaitTask : public Task {
public:
- DesktopNotificationServiceTest()
- : event_(false, false),
- ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
+ WaitTask(base::WaitableEvent* event)
+ : event_(event) {
}
-
- void LetIOThreadWait() {
- event_.Wait();
+ virtual void Run() {
+ event_->Wait();
}
+ private:
+ base::WaitableEvent* event_;
+};
+
+
+class DesktopNotificationServiceTest : public RenderViewHostTestHarness {
+ public:
+ DesktopNotificationServiceTest()
+ : event_(false, false) {
+ }
base::WaitableEvent event_;
- ScopedRunnableMethodFactory<DesktopNotificationServiceTest> method_factory_;
};
TEST_F(DesktopNotificationServiceTest, DefaultContentSettingSentToCache) {
@@ -34,9 +43,7 @@ TEST_F(DesktopNotificationServiceTest, DefaultContentSettingSentToCache) {
// Create IO thread, start its message loop.
ChromeThread io_thread(ChromeThread::IO);
io_thread.Start();
- ChromeThread::PostTask(ChromeThread::UI, FROM_HERE,
- method_factory_.NewRunnableMethod(
- &DesktopNotificationServiceTest::LetIOThreadWait));
+ ChromeThread::PostTask(ChromeThread::IO, FROM_HERE, new WaitTask(&event_));
// Creates the service, calls InitPrefs() on it which loads data from the
// profile into the cache and then puts the cache in io thread mode.
@@ -63,4 +70,4 @@ TEST_F(DesktopNotificationServiceTest, DefaultContentSettingSentToCache) {
EXPECT_EQ(CONTENT_SETTING_BLOCK, cache->CachedDefaultContentSetting());
}
-
+} // namespace
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698