| 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 "chrome/browser/renderer_host/text_input_client_mac.h" | 5 #import "chrome/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 "chrome/browser/renderer_host/text_input_client_message_filter.h" | 10 #include "chrome/browser/renderer_host/text_input_client_message_filter.h" |
| 11 #include "chrome/common/text_input_client_messages.h" | 11 #include "chrome/common/text_input_client_messages.h" |
| 12 #include "chrome/test/base/testing_browser_process_test.h" | |
| 13 #include "chrome/test/base/testing_profile.h" | 12 #include "chrome/test/base/testing_profile.h" |
| 14 #include "content/browser/renderer_host/mock_render_process_host.h" | 13 #include "content/browser/renderer_host/mock_render_process_host.h" |
| 15 #include "content/browser/renderer_host/render_process_host.h" | 14 #include "content/browser/renderer_host/render_process_host.h" |
| 16 #include "content/browser/renderer_host/render_widget_host.h" | 15 #include "content/browser/renderer_host/render_widget_host.h" |
| 17 #include "ipc/ipc_test_sink.h" | 16 #include "ipc/ipc_test_sink.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 19 #include "testing/gtest_mac.h" | 18 #include "testing/gtest_mac.h" |
| 20 | 19 |
| 21 namespace { | 20 namespace { |
| 22 | 21 |
| 23 const int64 kTaskDelayMs = 200; | 22 const int64 kTaskDelayMs = 200; |
| 24 | 23 |
| 25 // 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 |
| 26 // 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 |
| 27 // service's signaling system works. | 26 // service's signaling system works. |
| 28 class TextInputClientMacTest : public TestingBrowserProcessTest { | 27 class TextInputClientMacTest : public testing::Test { |
| 29 public: | 28 public: |
| 30 TextInputClientMacTest() | 29 TextInputClientMacTest() |
| 31 : message_loop_(MessageLoop::TYPE_UI), | 30 : message_loop_(MessageLoop::TYPE_UI), |
| 32 profile_(), | 31 profile_(), |
| 33 process_factory_(), | 32 process_factory_(), |
| 34 widget_(process_factory_.CreateRenderProcessHost(&profile_), 1), | 33 widget_(process_factory_.CreateRenderProcessHost(&profile_), 1), |
| 35 thread_("TextInputClientMacTestThread") {} | 34 thread_("TextInputClientMacTestThread") {} |
| 36 | 35 |
| 37 // Accessor for the TextInputClientMac instance. | 36 // Accessor for the TextInputClientMac instance. |
| 38 TextInputClientMac* service() { | 37 TextInputClientMac* service() { |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 TEST_F(TextInputClientMacTest, TimeoutSubstring) { | 203 TEST_F(TextInputClientMacTest, TimeoutSubstring) { |
| 205 NSAttributedString* string = service()->GetAttributedSubstringFromRange( | 204 NSAttributedString* string = service()->GetAttributedSubstringFromRange( |
| 206 widget(), NSMakeRange(0, 32)); | 205 widget(), NSMakeRange(0, 32)); |
| 207 EXPECT_EQ(nil, string); | 206 EXPECT_EQ(nil, string); |
| 208 EXPECT_EQ(1U, ipc_sink().message_count()); | 207 EXPECT_EQ(1U, ipc_sink().message_count()); |
| 209 EXPECT_TRUE(ipc_sink().GetUniqueMessageMatching( | 208 EXPECT_TRUE(ipc_sink().GetUniqueMessageMatching( |
| 210 TextInputClientMsg_StringForRange::ID)); | 209 TextInputClientMsg_StringForRange::ID)); |
| 211 } | 210 } |
| 212 | 211 |
| 213 } // namespace | 212 } // namespace |
| OLD | NEW |