OLD | NEW |
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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
10 #include "content/browser/renderer_host/render_process_host_impl.h" | 10 #include "content/browser/renderer_host/render_process_host_impl.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 class TextInputClientMacTest : public testing::Test { | 35 class TextInputClientMacTest : public testing::Test { |
36 public: | 36 public: |
37 TextInputClientMacTest() | 37 TextInputClientMacTest() |
38 : message_loop_(base::MessageLoop::TYPE_UI), | 38 : message_loop_(base::MessageLoop::TYPE_UI), |
39 browser_context_(), | 39 browser_context_(), |
40 process_factory_(), | 40 process_factory_(), |
41 delegate_(), | 41 delegate_(), |
42 widget_(&delegate_, | 42 widget_(&delegate_, |
43 process_factory_.CreateRenderProcessHost( | 43 process_factory_.CreateRenderProcessHost( |
44 &browser_context_, NULL), | 44 &browser_context_, NULL), |
45 MSG_ROUTING_NONE), | 45 MSG_ROUTING_NONE, false), |
46 thread_("TextInputClientMacTestThread") {} | 46 thread_("TextInputClientMacTestThread") {} |
47 | 47 |
48 // Accessor for the TextInputClientMac instance. | 48 // Accessor for the TextInputClientMac instance. |
49 TextInputClientMac* service() { | 49 TextInputClientMac* service() { |
50 return TextInputClientMac::GetInstance(); | 50 return TextInputClientMac::GetInstance(); |
51 } | 51 } |
52 | 52 |
53 // Helper method to post a task on the testing thread's MessageLoop after | 53 // Helper method to post a task on the testing thread's MessageLoop after |
54 // a short delay. | 54 // a short delay. |
55 void PostTask(const tracked_objects::Location& from_here, | 55 void PostTask(const tracked_objects::Location& from_here, |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 TEST_F(TextInputClientMacTest, TimeoutSubstring) { | 224 TEST_F(TextInputClientMacTest, TimeoutSubstring) { |
225 NSAttributedString* string = service()->GetAttributedSubstringFromRange( | 225 NSAttributedString* string = service()->GetAttributedSubstringFromRange( |
226 widget(), NSMakeRange(0, 32)); | 226 widget(), NSMakeRange(0, 32)); |
227 EXPECT_EQ(nil, string); | 227 EXPECT_EQ(nil, string); |
228 EXPECT_EQ(1U, ipc_sink().message_count()); | 228 EXPECT_EQ(1U, ipc_sink().message_count()); |
229 EXPECT_TRUE(ipc_sink().GetUniqueMessageMatching( | 229 EXPECT_TRUE(ipc_sink().GetUniqueMessageMatching( |
230 TextInputClientMsg_StringForRange::ID)); | 230 TextInputClientMsg_StringForRange::ID)); |
231 } | 231 } |
232 | 232 |
233 } // namespace content | 233 } // namespace content |
OLD | NEW |