| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 widget(), gfx::Point(2, 2)); | 141 widget(), gfx::Point(2, 2)); |
| 142 EXPECT_EQ(1U, ipc_sink().message_count()); | 142 EXPECT_EQ(1U, ipc_sink().message_count()); |
| 143 EXPECT_TRUE(ipc_sink().GetUniqueMessageMatching( | 143 EXPECT_TRUE(ipc_sink().GetUniqueMessageMatching( |
| 144 TextInputClientMsg_CharacterIndexForPoint::ID)); | 144 TextInputClientMsg_CharacterIndexForPoint::ID)); |
| 145 EXPECT_EQ(static_cast<NSUInteger>(NSNotFound), index); | 145 EXPECT_EQ(static_cast<NSUInteger>(NSNotFound), index); |
| 146 } | 146 } |
| 147 | 147 |
| 148 TEST_F(TextInputClientMacTest, NotFoundCharacterIndex) { | 148 TEST_F(TextInputClientMacTest, NotFoundCharacterIndex) { |
| 149 ScopedTestingThread thread(this); | 149 ScopedTestingThread thread(this); |
| 150 const NSUInteger kPreviousValue = 42; | 150 const NSUInteger kPreviousValue = 42; |
| 151 const size_t kNotFoundValue = static_cast<size_t>(-1); | 151 const uint32_t kNotFoundValue = static_cast<uint32_t>(-1); |
| 152 | 152 |
| 153 // Set an arbitrary value to ensure the index is not |NSNotFound|. | 153 // Set an arbitrary value to ensure the index is not |NSNotFound|. |
| 154 PostTask(FROM_HERE, | 154 PostTask(FROM_HERE, |
| 155 base::Bind(&TextInputClientMac::SetCharacterIndexAndSignal, | 155 base::Bind(&TextInputClientMac::SetCharacterIndexAndSignal, |
| 156 base::Unretained(service()), kPreviousValue)); | 156 base::Unretained(service()), kPreviousValue)); |
| 157 | 157 |
| 158 scoped_refptr<TextInputClientMessageFilter> filter( | 158 scoped_refptr<TextInputClientMessageFilter> filter( |
| 159 new TextInputClientMessageFilter(widget()->GetProcess()->GetID())); | 159 new TextInputClientMessageFilter(widget()->GetProcess()->GetID())); |
| 160 scoped_ptr<IPC::Message> message( | 160 scoped_ptr<IPC::Message> message( |
| 161 new TextInputClientReplyMsg_GotCharacterIndexForPoint( | 161 new TextInputClientReplyMsg_GotCharacterIndexForPoint( |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 197 |
| 198 TEST_F(TextInputClientMacTest, TimeoutRectForRange) { | 198 TEST_F(TextInputClientMacTest, TimeoutRectForRange) { |
| 199 NSRect rect = service()->GetFirstRectForRange(widget(), NSMakeRange(0, 32)); | 199 NSRect rect = service()->GetFirstRectForRange(widget(), NSMakeRange(0, 32)); |
| 200 EXPECT_EQ(1U, ipc_sink().message_count()); | 200 EXPECT_EQ(1U, ipc_sink().message_count()); |
| 201 EXPECT_TRUE(ipc_sink().GetUniqueMessageMatching( | 201 EXPECT_TRUE(ipc_sink().GetUniqueMessageMatching( |
| 202 TextInputClientMsg_FirstRectForCharacterRange::ID)); | 202 TextInputClientMsg_FirstRectForCharacterRange::ID)); |
| 203 EXPECT_NSEQ(NSZeroRect, rect); | 203 EXPECT_NSEQ(NSZeroRect, rect); |
| 204 } | 204 } |
| 205 | 205 |
| 206 } // namespace content | 206 } // namespace content |
| OLD | NEW |