OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 8 #include "base/message_loop.h" |
9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
10 #include "content/browser/renderer_host/mock_render_process_host.h" | 10 #include "content/browser/renderer_host/mock_render_process_host.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 // This test does not test the WebKit side of the dictionary system (which | 24 // This test does not test the WebKit side of the dictionary system (which |
25 // performs the actual data fetching), but rather this just tests that the | 25 // performs the actual data fetching), but rather this just tests that the |
26 // service's signaling system works. | 26 // service's signaling system works. |
27 class TextInputClientMacTest : public testing::Test { | 27 class TextInputClientMacTest : public testing::Test { |
28 public: | 28 public: |
29 TextInputClientMacTest() | 29 TextInputClientMacTest() |
30 : message_loop_(MessageLoop::TYPE_UI), | 30 : message_loop_(MessageLoop::TYPE_UI), |
31 browser_context_(), | 31 browser_context_(), |
32 process_factory_(), | 32 process_factory_(), |
33 widget_(process_factory_.CreateRenderProcessHost(&browser_context_), 1), | 33 widget_(process_factory_.CreateRenderProcessHost(&browser_context_), |
| 34 MSG_ROUTING_NONE), |
34 thread_("TextInputClientMacTestThread") {} | 35 thread_("TextInputClientMacTestThread") {} |
35 | 36 |
36 // Accessor for the TextInputClientMac instance. | 37 // Accessor for the TextInputClientMac instance. |
37 TextInputClientMac* service() { | 38 TextInputClientMac* service() { |
38 return TextInputClientMac::GetInstance(); | 39 return TextInputClientMac::GetInstance(); |
39 } | 40 } |
40 | 41 |
41 // Helper method to post a task on the testing thread's MessageLoop after | 42 // Helper method to post a task on the testing thread's MessageLoop after |
42 // a short delay. | 43 // a short delay. |
43 void PostTask(const tracked_objects::Location& from_here, | 44 void PostTask(const tracked_objects::Location& from_here, |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 TEST_F(TextInputClientMacTest, TimeoutSubstring) { | 204 TEST_F(TextInputClientMacTest, TimeoutSubstring) { |
204 NSAttributedString* string = service()->GetAttributedSubstringFromRange( | 205 NSAttributedString* string = service()->GetAttributedSubstringFromRange( |
205 widget(), NSMakeRange(0, 32)); | 206 widget(), NSMakeRange(0, 32)); |
206 EXPECT_EQ(nil, string); | 207 EXPECT_EQ(nil, string); |
207 EXPECT_EQ(1U, ipc_sink().message_count()); | 208 EXPECT_EQ(1U, ipc_sink().message_count()); |
208 EXPECT_TRUE(ipc_sink().GetUniqueMessageMatching( | 209 EXPECT_TRUE(ipc_sink().GetUniqueMessageMatching( |
209 TextInputClientMsg_StringForRange::ID)); | 210 TextInputClientMsg_StringForRange::ID)); |
210 } | 211 } |
211 | 212 |
212 } // namespace | 213 } // namespace |
OLD | NEW |