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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 base::Thread thread_; | 84 base::Thread thread_; |
85 }; | 85 }; |
86 | 86 |
87 //////////////////////////////////////////////////////////////////////////////// | 87 //////////////////////////////////////////////////////////////////////////////// |
88 | 88 |
89 // Helper class that Start()s and Stop()s a thread according to the scope of the | 89 // Helper class that Start()s and Stop()s a thread according to the scope of the |
90 // object. | 90 // object. |
91 class ScopedTestingThread { | 91 class ScopedTestingThread { |
92 public: | 92 public: |
93 ScopedTestingThread(TextInputClientMacTest* test) : thread_(test->thread_) { | 93 explicit ScopedTestingThread(TextInputClientMacTest* test) |
| 94 : thread_(test->thread_) { |
94 thread_.Start(); | 95 thread_.Start(); |
95 } | 96 } |
96 ~ScopedTestingThread() { | 97 ~ScopedTestingThread() { |
97 thread_.Stop(); | 98 thread_.Stop(); |
98 } | 99 } |
99 | 100 |
100 private: | 101 private: |
101 base::Thread& thread_; | 102 base::Thread& thread_; |
102 }; | 103 }; |
103 | 104 |
(...skipping 119 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 |