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

Side by Side Diff: content/browser/renderer_host/text_input_client_mac_unittest.mm

Issue 2132593002: Remove remaining calls to deprecated MessageLoop methods on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: h264_vt_encoder_unittest.cc Created 4 years, 5 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
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 #import "content/browser/renderer_host/text_input_client_mac.h" 5 #import "content/browser/renderer_host/text_input_client_mac.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/single_thread_task_runner.h"
12 #include "base/threading/thread.h" 13 #include "base/threading/thread.h"
13 #include "content/browser/renderer_host/render_process_host_impl.h" 14 #include "content/browser/renderer_host/render_process_host_impl.h"
14 #include "content/browser/renderer_host/render_widget_host_delegate.h" 15 #include "content/browser/renderer_host/render_widget_host_delegate.h"
15 #include "content/browser/renderer_host/render_widget_host_impl.h" 16 #include "content/browser/renderer_host/render_widget_host_impl.h"
16 #include "content/browser/renderer_host/text_input_client_message_filter.h" 17 #include "content/browser/renderer_host/text_input_client_message_filter.h"
17 #include "content/common/text_input_client_messages.h" 18 #include "content/common/text_input_client_messages.h"
18 #include "content/public/test/mock_render_process_host.h" 19 #include "content/public/test/mock_render_process_host.h"
19 #include "content/public/test/test_browser_context.h" 20 #include "content/public/test/test_browser_context.h"
20 #include "ipc/ipc_test_sink.h" 21 #include "ipc/ipc_test_sink.h"
21 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // Helper method to post a task on the testing thread's MessageLoop after 63 // Helper method to post a task on the testing thread's MessageLoop after
63 // a short delay. 64 // a short delay.
64 void PostTask(const tracked_objects::Location& from_here, 65 void PostTask(const tracked_objects::Location& from_here,
65 const base::Closure& task) { 66 const base::Closure& task) {
66 PostTask(from_here, task, base::TimeDelta::FromMilliseconds(kTaskDelayMs)); 67 PostTask(from_here, task, base::TimeDelta::FromMilliseconds(kTaskDelayMs));
67 } 68 }
68 69
69 void PostTask(const tracked_objects::Location& from_here, 70 void PostTask(const tracked_objects::Location& from_here,
70 const base::Closure& task, 71 const base::Closure& task,
71 const base::TimeDelta delay) { 72 const base::TimeDelta delay) {
72 thread_.message_loop()->PostDelayedTask(from_here, task, delay); 73 thread_.task_runner()->PostDelayedTask(from_here, task, delay);
73 } 74 }
74 75
75 RenderWidgetHostImpl* widget() { return widget_.get(); } 76 RenderWidgetHostImpl* widget() { return widget_.get(); }
76 77
77 IPC::TestSink& ipc_sink() { 78 IPC::TestSink& ipc_sink() {
78 return static_cast<MockRenderProcessHost*>(widget()->GetProcess())->sink(); 79 return static_cast<MockRenderProcessHost*>(widget()->GetProcess())->sink();
79 } 80 }
80 81
81 private: 82 private:
82 friend class ScopedTestingThread; 83 friend class ScopedTestingThread;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 197
197 TEST_F(TextInputClientMacTest, TimeoutRectForRange) { 198 TEST_F(TextInputClientMacTest, TimeoutRectForRange) {
198 NSRect rect = service()->GetFirstRectForRange(widget(), NSMakeRange(0, 32)); 199 NSRect rect = service()->GetFirstRectForRange(widget(), NSMakeRange(0, 32));
199 EXPECT_EQ(1U, ipc_sink().message_count()); 200 EXPECT_EQ(1U, ipc_sink().message_count());
200 EXPECT_TRUE(ipc_sink().GetUniqueMessageMatching( 201 EXPECT_TRUE(ipc_sink().GetUniqueMessageMatching(
201 TextInputClientMsg_FirstRectForCharacterRange::ID)); 202 TextInputClientMsg_FirstRectForCharacterRange::ID));
202 EXPECT_NSEQ(NSZeroRect, rect); 203 EXPECT_NSEQ(NSZeroRect, rect);
203 } 204 }
204 205
205 } // namespace content 206 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.mm ('k') | content/renderer/render_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698