| 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.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/render_process_host_impl.h" | 10 #include "content/browser/renderer_host/render_process_host_impl.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // performs the actual data fetching), but rather this just tests that the | 33 // performs the actual data fetching), but rather this just tests that the |
| 34 // service's signaling system works. | 34 // service's signaling system works. |
| 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(&browser_context_), | 43 process_factory_.CreateRenderProcessHost( |
| 44 &browser_context_, NULL, NULL), |
| 44 MSG_ROUTING_NONE), | 45 MSG_ROUTING_NONE), |
| 45 thread_("TextInputClientMacTestThread") {} | 46 thread_("TextInputClientMacTestThread") {} |
| 46 | 47 |
| 47 // Accessor for the TextInputClientMac instance. | 48 // Accessor for the TextInputClientMac instance. |
| 48 TextInputClientMac* service() { | 49 TextInputClientMac* service() { |
| 49 return TextInputClientMac::GetInstance(); | 50 return TextInputClientMac::GetInstance(); |
| 50 } | 51 } |
| 51 | 52 |
| 52 // 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 |
| 53 // a short delay. | 54 // a short delay. |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 TEST_F(TextInputClientMacTest, TimeoutSubstring) { | 224 TEST_F(TextInputClientMacTest, TimeoutSubstring) { |
| 224 NSAttributedString* string = service()->GetAttributedSubstringFromRange( | 225 NSAttributedString* string = service()->GetAttributedSubstringFromRange( |
| 225 widget(), NSMakeRange(0, 32)); | 226 widget(), NSMakeRange(0, 32)); |
| 226 EXPECT_EQ(nil, string); | 227 EXPECT_EQ(nil, string); |
| 227 EXPECT_EQ(1U, ipc_sink().message_count()); | 228 EXPECT_EQ(1U, ipc_sink().message_count()); |
| 228 EXPECT_TRUE(ipc_sink().GetUniqueMessageMatching( | 229 EXPECT_TRUE(ipc_sink().GetUniqueMessageMatching( |
| 229 TextInputClientMsg_StringForRange::ID)); | 230 TextInputClientMsg_StringForRange::ID)); |
| 230 } | 231 } |
| 231 | 232 |
| 232 } // namespace content | 233 } // namespace content |
| OLD | NEW |