| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2013 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2013 Google Inc. All Rights Reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "platform/heap/Handle.h" | 34 #include "platform/heap/Handle.h" |
| 35 #include "wtf/Forward.h" | 35 #include "wtf/Forward.h" |
| 36 #include "wtf/OwnPtr.h" | 36 #include "wtf/OwnPtr.h" |
| 37 #include "wtf/PassOwnPtr.h" | 37 #include "wtf/PassOwnPtr.h" |
| 38 #include <gtest/gtest.h> | 38 #include <gtest/gtest.h> |
| 39 | 39 |
| 40 using namespace blink; | 40 using namespace blink; |
| 41 | 41 |
| 42 namespace { | 42 namespace { |
| 43 | 43 |
| 44 class MarkingBooleanTask FINAL : public ExecutionContextTask { | 44 class MarkingBooleanTask final : public ExecutionContextTask { |
| 45 public: | 45 public: |
| 46 static PassOwnPtr<MarkingBooleanTask> create(bool* toBeMarked) | 46 static PassOwnPtr<MarkingBooleanTask> create(bool* toBeMarked) |
| 47 { | 47 { |
| 48 return adoptPtr(new MarkingBooleanTask(toBeMarked)); | 48 return adoptPtr(new MarkingBooleanTask(toBeMarked)); |
| 49 } | 49 } |
| 50 | 50 |
| 51 | 51 |
| 52 virtual ~MarkingBooleanTask() { } | 52 virtual ~MarkingBooleanTask() { } |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 MarkingBooleanTask(bool* toBeMarked) : m_toBeMarked(toBeMarked) { } | 55 MarkingBooleanTask(bool* toBeMarked) : m_toBeMarked(toBeMarked) { } |
| 56 | 56 |
| 57 virtual void performTask(ExecutionContext* context) OVERRIDE | 57 virtual void performTask(ExecutionContext* context) override |
| 58 { | 58 { |
| 59 *m_toBeMarked = true; | 59 *m_toBeMarked = true; |
| 60 } | 60 } |
| 61 | 61 |
| 62 bool* m_toBeMarked; | 62 bool* m_toBeMarked; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 TEST(MainThreadTaskRunnerTest, PostTask) | 65 TEST(MainThreadTaskRunnerTest, PostTask) |
| 66 { | 66 { |
| 67 RefPtrWillBeRawPtr<NullExecutionContext> context = adoptRefWillBeNoop(new Nu
llExecutionContext()); | 67 RefPtrWillBeRawPtr<NullExecutionContext> context = adoptRefWillBeNoop(new Nu
llExecutionContext()); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 bool isMarked = false; | 99 bool isMarked = false; |
| 100 | 100 |
| 101 context->setTasksNeedSuspension(true); | 101 context->setTasksNeedSuspension(true); |
| 102 runner->postTask(MarkingBooleanTask::create(&isMarked)); | 102 runner->postTask(MarkingBooleanTask::create(&isMarked)); |
| 103 runner.clear(); | 103 runner.clear(); |
| 104 blink::testing::runPendingTasks(); | 104 blink::testing::runPendingTasks(); |
| 105 EXPECT_FALSE(isMarked); | 105 EXPECT_FALSE(isMarked); |
| 106 } | 106 } |
| 107 | 107 |
| 108 } | 108 } |
| OLD | NEW |