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

Side by Side Diff: net/base/test_completion_callback_unittest.cc

Issue 4096: Use open-vcdiff for sdch compression on the Mac (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/sdch_filter_unitest.cc ('k') | net/net.xcodeproj/project.pbxproj » ('j') | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // Illustrates how to use worker threads that issue completion callbacks 5 // Illustrates how to use worker threads that issue completion callbacks
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "net/base/completion_callback.h" 8 #include "net/base/completion_callback.h"
9 #include "net/base/test_completion_callback.h" 9 #include "net/base/test_completion_callback.h"
10 #include "base/platform_test.h"
10 #include "base/worker_pool.h" 11 #include "base/worker_pool.h"
11 12
13 typedef PlatformTest TestCompletionCallbackTest;
14
12 using net::CompletionCallback; 15 using net::CompletionCallback;
13 16
14 const int kMagicResult = 8888; 17 const int kMagicResult = 8888;
15 18
16 // ExampleEmployer is a toy version of HostResolver 19 // ExampleEmployer is a toy version of HostResolver
17 // TODO: restore damage done in extracting example from real code 20 // TODO: restore damage done in extracting example from real code
18 // (e.g. bring back real destructor, bring back comments) 21 // (e.g. bring back real destructor, bring back comments)
19 class ExampleEmployer { 22 class ExampleEmployer {
20 public: 23 public:
21 ExampleEmployer(); 24 ExampleEmployer();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 if (!WorkerPool::PostTask(FROM_HERE, 101 if (!WorkerPool::PostTask(FROM_HERE,
99 NewRunnableMethod(request_.get(), &ExampleWorker::DoWork), true)) { 102 NewRunnableMethod(request_.get(), &ExampleWorker::DoWork), true)) {
100 NOTREACHED(); 103 NOTREACHED();
101 request_ = NULL; 104 request_ = NULL;
102 return false; 105 return false;
103 } 106 }
104 107
105 return true; 108 return true;
106 } 109 }
107 110
108 TEST(TestCompletionCallbackTest, Simple) { 111 TEST_F(TestCompletionCallbackTest, Simple) {
109 ExampleEmployer boss; 112 ExampleEmployer boss;
110 TestCompletionCallback callback; 113 TestCompletionCallback callback;
111 bool queued = boss.DoSomething(&callback); 114 bool queued = boss.DoSomething(&callback);
112 EXPECT_EQ(queued, true); 115 EXPECT_EQ(queued, true);
113 int result = callback.WaitForResult(); 116 int result = callback.WaitForResult();
114 EXPECT_EQ(result, kMagicResult); 117 EXPECT_EQ(result, kMagicResult);
115 } 118 }
116 119
117 // TODO: test deleting ExampleEmployer while work outstanding 120 // TODO: test deleting ExampleEmployer while work outstanding
OLDNEW
« no previous file with comments | « net/base/sdch_filter_unitest.cc ('k') | net/net.xcodeproj/project.pbxproj » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698