Chromium Code Reviews| 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" |
| 11 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 11 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
| 12 #include "content/browser/renderer_host/render_widget_host_impl.h" | 12 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 13 #include "content/browser/renderer_host/text_input_client_message_filter.h" | 13 #include "content/browser/renderer_host/text_input_client_message_filter.h" |
| 14 #include "content/common/text_input_client_messages.h" | 14 #include "content/common/text_input_client_messages.h" |
| 15 #include "content/public/test/mock_render_process_host.h" | 15 #include "content/public/test/mock_render_process_host.h" |
| 16 #include "content/test//test_browser_context.h" | 16 #include "content/public/test//test_browser_context.h" |
|
Paweł Hajdan Jr.
2012/06/05 09:47:24
nit: Double slash.
jam
2012/06/05 15:57:54
fixed in followup
| |
| 17 #include "ipc/ipc_test_sink.h" | 17 #include "ipc/ipc_test_sink.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 #include "testing/gtest_mac.h" | 19 #include "testing/gtest_mac.h" |
| 20 | 20 |
| 21 using content::MockRenderProcessHost; | 21 using content::MockRenderProcessHost; |
| 22 using content::MockRenderProcessHostFactory; | 22 using content::MockRenderProcessHostFactory; |
| 23 using content::RenderWidgetHostImpl; | 23 using content::RenderWidgetHostImpl; |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 } | 70 } |
| 71 | 71 |
| 72 IPC::TestSink& ipc_sink() { | 72 IPC::TestSink& ipc_sink() { |
| 73 return static_cast<MockRenderProcessHost*>(widget()->GetProcess())->sink(); | 73 return static_cast<MockRenderProcessHost*>(widget()->GetProcess())->sink(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 friend class ScopedTestingThread; | 77 friend class ScopedTestingThread; |
| 78 | 78 |
| 79 MessageLoop message_loop_; | 79 MessageLoop message_loop_; |
| 80 TestBrowserContext browser_context_; | 80 content::TestBrowserContext browser_context_; |
| 81 | 81 |
| 82 // Gets deleted when the last RWH in the "process" gets destroyed. | 82 // Gets deleted when the last RWH in the "process" gets destroyed. |
| 83 MockRenderProcessHostFactory process_factory_; | 83 MockRenderProcessHostFactory process_factory_; |
| 84 MockRenderWidgetHostDelegate delegate_; | 84 MockRenderWidgetHostDelegate delegate_; |
| 85 RenderWidgetHostImpl widget_; | 85 RenderWidgetHostImpl widget_; |
| 86 | 86 |
| 87 base::Thread thread_; | 87 base::Thread thread_; |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 //////////////////////////////////////////////////////////////////////////////// | 90 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 133 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 | 233 } // namespace |
| OLD | NEW |