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

Unified Diff: base/task_runner_util_unittest.cc

Issue 1647803004: Move base to DEPS (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 11 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 | « base/task_runner_util.h ('k') | base/template_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/task_runner_util_unittest.cc
diff --git a/base/task_runner_util_unittest.cc b/base/task_runner_util_unittest.cc
deleted file mode 100644
index 8245cfcdc50a94b3517b2a545b99315f971909b6..0000000000000000000000000000000000000000
--- a/base/task_runner_util_unittest.cc
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/task_runner_util.h"
-
-#include "base/bind.h"
-#include "base/location.h"
-#include "base/run_loop.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace base {
-
-namespace {
-
-int ReturnFourtyTwo() {
- return 42;
-}
-
-void StoreValue(int* destination, int value) {
- *destination = value;
-}
-
-void StoreDoubleValue(double* destination, double value) {
- *destination = value;
-}
-
-int g_foo_destruct_count = 0;
-int g_foo_free_count = 0;
-
-struct Foo {
- ~Foo() {
- ++g_foo_destruct_count;
- }
-};
-
-scoped_ptr<Foo> CreateFoo() {
- return scoped_ptr<Foo>(new Foo);
-}
-
-void ExpectFoo(scoped_ptr<Foo> foo) {
- EXPECT_TRUE(foo.get());
- scoped_ptr<Foo> local_foo(foo.Pass());
- EXPECT_TRUE(local_foo.get());
- EXPECT_FALSE(foo.get());
-}
-
-struct FooDeleter {
- void operator()(Foo* foo) const {
- ++g_foo_free_count;
- delete foo;
- };
-};
-
-scoped_ptr<Foo, FooDeleter> CreateScopedFoo() {
- return scoped_ptr<Foo, FooDeleter>(new Foo);
-}
-
-void ExpectScopedFoo(scoped_ptr<Foo, FooDeleter> foo) {
- EXPECT_TRUE(foo.get());
- scoped_ptr<Foo, FooDeleter> local_foo(foo.Pass());
- EXPECT_TRUE(local_foo.get());
- EXPECT_FALSE(foo.get());
-}
-
-} // namespace
-
-TEST(TaskRunnerHelpersTest, PostTaskAndReplyWithResult) {
- int result = 0;
-
- MessageLoop message_loop;
- PostTaskAndReplyWithResult(message_loop.task_runner().get(), FROM_HERE,
- Bind(&ReturnFourtyTwo),
- Bind(&StoreValue, &result));
-
- RunLoop().RunUntilIdle();
-
- EXPECT_EQ(42, result);
-}
-
-TEST(TaskRunnerHelpersTest, PostTaskAndReplyWithResultImplicitConvert) {
- double result = 0;
-
- MessageLoop message_loop;
- PostTaskAndReplyWithResult(message_loop.task_runner().get(), FROM_HERE,
- Bind(&ReturnFourtyTwo),
- Bind(&StoreDoubleValue, &result));
-
- RunLoop().RunUntilIdle();
-
- EXPECT_DOUBLE_EQ(42.0, result);
-}
-
-TEST(TaskRunnerHelpersTest, PostTaskAndReplyWithResultPassed) {
- g_foo_destruct_count = 0;
- g_foo_free_count = 0;
-
- MessageLoop message_loop;
- PostTaskAndReplyWithResult(message_loop.task_runner().get(), FROM_HERE,
- Bind(&CreateFoo), Bind(&ExpectFoo));
-
- RunLoop().RunUntilIdle();
-
- EXPECT_EQ(1, g_foo_destruct_count);
- EXPECT_EQ(0, g_foo_free_count);
-}
-
-TEST(TaskRunnerHelpersTest, PostTaskAndReplyWithResultPassedFreeProc) {
- g_foo_destruct_count = 0;
- g_foo_free_count = 0;
-
- MessageLoop message_loop;
- PostTaskAndReplyWithResult(message_loop.task_runner().get(), FROM_HERE,
- Bind(&CreateScopedFoo), Bind(&ExpectScopedFoo));
-
- RunLoop().RunUntilIdle();
-
- EXPECT_EQ(1, g_foo_destruct_count);
- EXPECT_EQ(1, g_foo_free_count);
-}
-
-} // namespace base
« no previous file with comments | « base/task_runner_util.h ('k') | base/template_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698