summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-03 03:14:44 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-03 03:14:44 +0000
commitafcd76b79e147c18fb20daed6e226b67d9152d0b (patch)
tree0f64fe61cdd181cd473364bfc31c9f248fbcbc38
parent78dcb900b1ae1209d87cd746c1ff7d4c13f9f04e (diff)
downloadchromium_src-afcd76b79e147c18fb20daed6e226b67d9152d0b.zip
chromium_src-afcd76b79e147c18fb20daed6e226b67d9152d0b.tar.gz
chromium_src-afcd76b79e147c18fb20daed6e226b67d9152d0b.tar.bz2
Attempted build fix: Run IO blocking task actually on IO thread.
TBR=dhollowa Review URL: http://codereview.chromium.org/2800041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51588 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/notifications/desktop_notification_service_unittest.cc31
1 files changed, 19 insertions, 12 deletions
diff --git a/chrome/browser/notifications/desktop_notification_service_unittest.cc b/chrome/browser/notifications/desktop_notification_service_unittest.cc
index 27ceb8c..4e0a705 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