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

Unified Diff: content/browser/browser_thread_unittest.cc

Issue 7210053: Implementation of PostTaskAndReply() in MessageLoopProxy and BrowserThread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copyright Created 9 years, 4 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 | « content/browser/browser_thread.cc ('k') | tools/valgrind/memcheck/suppressions.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/browser_thread_unittest.cc
diff --git a/content/browser/browser_thread_unittest.cc b/content/browser/browser_thread_unittest.cc
index 0a3ff1717a44ad6715d2cc5d453df002812eaec1..f5f6e478d029559f8ea229eaa22ee6f303c5ae1a 100644
--- a/content/browser/browser_thread_unittest.cc
+++ b/content/browser/browser_thread_unittest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/bind.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "base/message_loop_proxy.h"
@@ -34,6 +35,9 @@ class BrowserThreadTest : public testing::Test {
message_loop->PostTask(FROM_HERE, new MessageLoop::QuitTask);
}
+ static void DoNothing() {
+ }
+
class DummyTask : public Task {
public:
explicit DummyTask(bool* deleted) : deleted_(deleted) { }
@@ -130,6 +134,19 @@ TEST_F(BrowserThreadTest, ReleaseViaMessageLoopProxy) {
MessageLoop::current()->Run();
}
+TEST_F(BrowserThreadTest, PostTaskAndReply) {
+ // Most of the heavy testing for PostTaskAndReply() is done inside the
+ // MessageLoopProxy test. This just makes sure we get piped through at all.
+ ASSERT_TRUE(BrowserThread::PostTaskAndReply(
+ BrowserThread::FILE,
+ FROM_HERE,
+ base::Bind(&BrowserThreadTest::DoNothing),
+ base::Bind(&MessageLoop::Quit,
+ base::Unretained(MessageLoop::current()->current()))));
+ MessageLoop::current()->Run();
+}
+
+
TEST_F(BrowserThreadTest, TaskToNonExistentThreadIsDeletedViaMessageLoopProxy) {
bool deleted = false;
scoped_refptr<base::MessageLoopProxy> message_loop_proxy =
@@ -163,4 +180,3 @@ TEST_F(BrowserThreadTest, PostTaskViaMessageLoopProxyAfterThreadIsDeleted) {
EXPECT_FALSE(ret);
EXPECT_TRUE(deleted);
}
-
« no previous file with comments | « content/browser/browser_thread.cc ('k') | tools/valgrind/memcheck/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698