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

Side by Side Diff: src/libplatform/task-queue-unittest.cc

Issue 615393002: Move unit tests to test/unittests. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE Created 6 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 | « src/libplatform/libplatform.gyp ('k') | src/libplatform/worker-thread-unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "include/v8-platform.h"
6 #include "src/base/platform/platform.h"
7 #include "src/libplatform/task-queue.h"
8 #include "testing/gmock/include/gmock/gmock.h"
9
10 using testing::InSequence;
11 using testing::IsNull;
12 using testing::StrictMock;
13
14 namespace v8 {
15 namespace platform {
16
17 namespace {
18
19 struct MockTask : public Task {
20 MOCK_METHOD0(Run, void());
21 };
22
23
24 class TaskQueueThread FINAL : public base::Thread {
25 public:
26 explicit TaskQueueThread(TaskQueue* queue)
27 : Thread(Options("libplatform TaskQueueThread")), queue_(queue) {}
28
29 virtual void Run() OVERRIDE { EXPECT_THAT(queue_->GetNext(), IsNull()); }
30
31 private:
32 TaskQueue* queue_;
33 };
34
35 } // namespace
36
37
38 TEST(TaskQueueTest, Basic) {
39 TaskQueue queue;
40 MockTask task;
41 queue.Append(&task);
42 EXPECT_EQ(&task, queue.GetNext());
43 queue.Terminate();
44 EXPECT_THAT(queue.GetNext(), IsNull());
45 }
46
47
48 TEST(TaskQueueTest, TerminateMultipleReaders) {
49 TaskQueue queue;
50 TaskQueueThread thread1(&queue);
51 TaskQueueThread thread2(&queue);
52 thread1.Start();
53 thread2.Start();
54 queue.Terminate();
55 thread1.Join();
56 thread2.Join();
57 }
58
59 } // namespace platform
60 } // namespace v8
OLDNEW
« no previous file with comments | « src/libplatform/libplatform.gyp ('k') | src/libplatform/worker-thread-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698