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

Side by Side Diff: ppapi/shared_impl/thread_aware_callback_unittest.cc

Issue 630883002: replace OVERRIDE and FINAL with override and final in ppapi/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « ppapi/shared_impl/test_globals.h ('k') | ppapi/shared_impl/tracked_callback_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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "ppapi/shared_impl/thread_aware_callback.h" 5 #include "ppapi/shared_impl/thread_aware_callback.h"
6 6
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // even when requested from a different thread. 51 // even when requested from a different thread.
52 class ThreadAwareCallbackMultiThreadTest 52 class ThreadAwareCallbackMultiThreadTest
53 : public proxy::PluginProxyMultiThreadTest { 53 : public proxy::PluginProxyMultiThreadTest {
54 public: 54 public:
55 ThreadAwareCallbackMultiThreadTest() : main_thread_callback_called_(false) {} 55 ThreadAwareCallbackMultiThreadTest() : main_thread_callback_called_(false) {}
56 virtual ~ThreadAwareCallbackMultiThreadTest() { 56 virtual ~ThreadAwareCallbackMultiThreadTest() {
57 CHECK(main_thread_callback_called_); 57 CHECK(main_thread_callback_called_);
58 } 58 }
59 59
60 // proxy::PluginProxyMultiThreadTest implementation. 60 // proxy::PluginProxyMultiThreadTest implementation.
61 virtual void SetUpTestOnMainThread() OVERRIDE { 61 virtual void SetUpTestOnMainThread() override {
62 ProxyAutoLock auto_lock; 62 ProxyAutoLock auto_lock;
63 63
64 main_thread_callback_.reset( 64 main_thread_callback_.reset(
65 ThreadAwareCallback<CallbackFunc>::Create(&MainThreadCallbackBody)); 65 ThreadAwareCallback<CallbackFunc>::Create(&MainThreadCallbackBody));
66 } 66 }
67 67
68 virtual void SetUpTestOnSecondaryThread() OVERRIDE { 68 virtual void SetUpTestOnSecondaryThread() override {
69 { 69 {
70 ProxyAutoLock auto_lock; 70 ProxyAutoLock auto_lock;
71 main_thread_callback_->RunOnTargetThread(this); 71 main_thread_callback_->RunOnTargetThread(this);
72 } 72 }
73 73
74 PostQuitForSecondaryThread(); 74 PostQuitForSecondaryThread();
75 PostQuitForMainThread(); 75 PostQuitForMainThread();
76 } 76 }
77 77
78 private: 78 private:
(...skipping 17 matching lines...) Expand all
96 }; 96 };
97 97
98 // Test that when a ThreadAwareCallback instance is destroyed, pending tasks to 98 // Test that when a ThreadAwareCallback instance is destroyed, pending tasks to
99 // run the callback will be ignored. 99 // run the callback will be ignored.
100 class ThreadAwareCallbackAbortTest : public proxy::PluginProxyMultiThreadTest { 100 class ThreadAwareCallbackAbortTest : public proxy::PluginProxyMultiThreadTest {
101 public: 101 public:
102 ThreadAwareCallbackAbortTest() {} 102 ThreadAwareCallbackAbortTest() {}
103 virtual ~ThreadAwareCallbackAbortTest() {} 103 virtual ~ThreadAwareCallbackAbortTest() {}
104 104
105 // proxy::PluginProxyMultiThreadTest implementation. 105 // proxy::PluginProxyMultiThreadTest implementation.
106 virtual void SetUpTestOnMainThread() OVERRIDE { 106 virtual void SetUpTestOnMainThread() override {
107 ProxyAutoLock auto_lock; 107 ProxyAutoLock auto_lock;
108 108
109 main_thread_callback_.reset( 109 main_thread_callback_.reset(
110 ThreadAwareCallback<CallbackFunc>::Create(&MainThreadCallbackBody)); 110 ThreadAwareCallback<CallbackFunc>::Create(&MainThreadCallbackBody));
111 } 111 }
112 112
113 virtual void SetUpTestOnSecondaryThread() OVERRIDE { 113 virtual void SetUpTestOnSecondaryThread() override {
114 { 114 {
115 ProxyAutoLock auto_lock; 115 ProxyAutoLock auto_lock;
116 main_thread_message_loop_proxy_->PostTask( 116 main_thread_message_loop_proxy_->PostTask(
117 FROM_HERE, 117 FROM_HERE,
118 base::Bind(&ThreadAwareCallbackAbortTest::DeleteCallback, 118 base::Bind(&ThreadAwareCallbackAbortTest::DeleteCallback,
119 base::Unretained(this))); 119 base::Unretained(this)));
120 // |main_thread_callback_| is still valid, even if DeleteCallback() can be 120 // |main_thread_callback_| is still valid, even if DeleteCallback() can be
121 // called before this following statement. That is because |auto_lock| is 121 // called before this following statement. That is because |auto_lock| is
122 // still held by this method, which prevents DeleteCallback() from 122 // still held by this method, which prevents DeleteCallback() from
123 // deleting the callback. 123 // deleting the callback.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 1, &double_arg, &bool_arg, object_arg, object_arg); 190 1, &double_arg, &bool_arg, object_arg, object_arg);
191 191
192 EXPECT_EQ(6, called_num); 192 EXPECT_EQ(6, called_num);
193 } 193 }
194 194
195 TEST_F(ThreadAwareCallbackMultiThreadTest, RunOnTargetThread) { RunTest(); } 195 TEST_F(ThreadAwareCallbackMultiThreadTest, RunOnTargetThread) { RunTest(); }
196 196
197 TEST_F(ThreadAwareCallbackAbortTest, NotRunIfAborted) { RunTest(); } 197 TEST_F(ThreadAwareCallbackAbortTest, NotRunIfAborted) { RunTest(); }
198 198
199 } // namespace ppapi 199 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/test_globals.h ('k') | ppapi/shared_impl/tracked_callback_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698