Commit 62532560 authored by bashi@chromium.org's avatar bashi@chromium.org

Revert 86246 - Fix assertion failure in range.mm while examining system dictionary popup.

Convert WTF::notFound to NSNotFound.

BUG=83158
TEST=chrome/browser/renderer_host/text_input_client_mac_unittest.mm

Review URL: http://codereview.chromium.org/7039054

TBR=bashi@chromium.org
Review URL: http://codereview.chromium.org/7019033

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86248 0039d316-1c4b-4281-b951-d872f2087c98
parent 73e2c8cd
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/message_loop.h" #include "base/message_loop.h"
#include "base/threading/thread.h" #include "base/threading/thread.h"
#include "chrome/browser/renderer_host/text_input_client_message_filter.h"
#include "chrome/common/text_input_client_messages.h" #include "chrome/common/text_input_client_messages.h"
#include "chrome/test/testing_profile.h" #include "chrome/test/testing_profile.h"
#include "content/browser/renderer_host/mock_render_process_host.h" #include "content/browser/renderer_host/mock_render_process_host.h"
...@@ -107,32 +106,6 @@ TEST_F(TextInputClientMacTest, TimeoutCharacterIndex) { ...@@ -107,32 +106,6 @@ TEST_F(TextInputClientMacTest, TimeoutCharacterIndex) {
EXPECT_EQ(NSNotFound, index); EXPECT_EQ(NSNotFound, index);
} }
TEST_F(TextInputClientMacTest, NotFoundCharacterIndex) {
ScopedTestingThread thread(this);
const NSUInteger kPreviousValue = 42;
const size_t kNotFoundValue = static_cast<size_t>(-1);
// Set an arbitrary value to ensure the index is not |NSNotFound|.
PostTask(base::Bind(&TextInputClientMac::SetCharacterIndexAndSignal,
base::Unretained(service()), kPreviousValue));
scoped_refptr<TextInputClientMessageFilter> filter(
new TextInputClientMessageFilter(widget()->process()->id()));
scoped_ptr<IPC::Message> message(
new TextInputClientReplyMsg_GotCharacterIndexForPoint(
widget()->routing_id(), kNotFoundValue));
bool message_ok = true;
PostTask(base::Bind(&TextInputClientMessageFilter::OnMessageReceived,
filter.get(), *message, &message_ok));
NSUInteger index = service()->GetCharacterIndexAtPoint(
widget(), gfx::Point(2, 2));
EXPECT_EQ(1U, ipc_sink().message_count());
EXPECT_TRUE(ipc_sink().GetUniqueMessageMatching(
TextInputClientMsg_CharacterIndexForPoint::ID));
EXPECT_EQ(NSNotFound, index);
}
TEST_F(TextInputClientMacTest, GetRectForRange) { TEST_F(TextInputClientMacTest, GetRectForRange) {
ScopedTestingThread thread(this); ScopedTestingThread thread(this);
const NSRect kSuccessValue = NSMakeRect(42, 43, 44, 45); const NSRect kSuccessValue = NSMakeRect(42, 43, 44, 45);
......
...@@ -43,11 +43,6 @@ bool TextInputClientMessageFilter::OnMessageReceived( ...@@ -43,11 +43,6 @@ bool TextInputClientMessageFilter::OnMessageReceived(
void TextInputClientMessageFilter::OnGotCharacterIndexForPoint(size_t index) { void TextInputClientMessageFilter::OnGotCharacterIndexForPoint(size_t index) {
TextInputClientMac* service = TextInputClientMac::GetInstance(); TextInputClientMac* service = TextInputClientMac::GetInstance();
// |index| could be WTF::notFound (-1) and it's value is different from
// NSNotFound so we need to convert it.
if (index == static_cast<size_t>(-1)) {
index = NSNotFound;
}
service->SetCharacterIndexAndSignal(index); service->SetCharacterIndexAndSignal(index);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment