Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: content/browser/renderer_host/text_input_client_mac_unittest.mm

Issue 8515027: Define the public version of the browser side RenderProcessHost interface. This interface is not ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/renderer_host/test_render_view_host.cc ('k') | content/browser/site_instance.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "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 "chrome/test/base/testing_profile.h" 10 #include "chrome/test/base/testing_profile.h"
11 #include "content/browser/renderer_host/mock_render_process_host.h" 11 #include "content/browser/renderer_host/mock_render_process_host.h"
12 #include "content/browser/renderer_host/render_process_host.h" 12 #include "content/browser/renderer_host/render_process_host_impl.h"
13 #include "content/browser/renderer_host/render_widget_host.h" 13 #include "content/browser/renderer_host/render_widget_host.h"
14 #include "content/browser/renderer_host/text_input_client_message_filter.h" 14 #include "content/browser/renderer_host/text_input_client_message_filter.h"
15 #include "content/common/text_input_client_messages.h" 15 #include "content/common/text_input_client_messages.h"
16 #include "ipc/ipc_test_sink.h" 16 #include "ipc/ipc_test_sink.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 #include "testing/gtest_mac.h" 18 #include "testing/gtest_mac.h"
19 19
20 namespace { 20 namespace {
21 21
22 const int64 kTaskDelayMs = 200; 22 const int64 kTaskDelayMs = 200;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 ScopedTestingThread thread(this); 122 ScopedTestingThread thread(this);
123 const NSUInteger kPreviousValue = 42; 123 const NSUInteger kPreviousValue = 42;
124 const size_t kNotFoundValue = static_cast<size_t>(-1); 124 const size_t kNotFoundValue = static_cast<size_t>(-1);
125 125
126 // Set an arbitrary value to ensure the index is not |NSNotFound|. 126 // Set an arbitrary value to ensure the index is not |NSNotFound|.
127 PostTask(FROM_HERE, 127 PostTask(FROM_HERE,
128 base::Bind(&TextInputClientMac::SetCharacterIndexAndSignal, 128 base::Bind(&TextInputClientMac::SetCharacterIndexAndSignal,
129 base::Unretained(service()), kPreviousValue)); 129 base::Unretained(service()), kPreviousValue));
130 130
131 scoped_refptr<TextInputClientMessageFilter> filter( 131 scoped_refptr<TextInputClientMessageFilter> filter(
132 new TextInputClientMessageFilter(widget()->process()->id())); 132 new TextInputClientMessageFilter(widget()->process()->GetID()));
133 scoped_ptr<IPC::Message> message( 133 scoped_ptr<IPC::Message> message(
134 new TextInputClientReplyMsg_GotCharacterIndexForPoint( 134 new TextInputClientReplyMsg_GotCharacterIndexForPoint(
135 widget()->routing_id(), kNotFoundValue)); 135 widget()->routing_id(), kNotFoundValue));
136 bool message_ok = true; 136 bool message_ok = true;
137 // Set |WTF::notFound| to the index |kTaskDelayMs| after the previous 137 // Set |WTF::notFound| to the index |kTaskDelayMs| after the previous
138 // setting. 138 // setting.
139 PostTask(FROM_HERE, 139 PostTask(FROM_HERE,
140 base::Bind(&CallOnMessageReceived, filter, *message, &message_ok), 140 base::Bind(&CallOnMessageReceived, filter, *message, &message_ok),
141 kTaskDelayMs * 2); 141 kTaskDelayMs * 2);
142 142
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 TEST_F(TextInputClientMacTest, TimeoutSubstring) { 203 TEST_F(TextInputClientMacTest, TimeoutSubstring) {
204 NSAttributedString* string = service()->GetAttributedSubstringFromRange( 204 NSAttributedString* string = service()->GetAttributedSubstringFromRange(
205 widget(), NSMakeRange(0, 32)); 205 widget(), NSMakeRange(0, 32));
206 EXPECT_EQ(nil, string); 206 EXPECT_EQ(nil, string);
207 EXPECT_EQ(1U, ipc_sink().message_count()); 207 EXPECT_EQ(1U, ipc_sink().message_count());
208 EXPECT_TRUE(ipc_sink().GetUniqueMessageMatching( 208 EXPECT_TRUE(ipc_sink().GetUniqueMessageMatching(
209 TextInputClientMsg_StringForRange::ID)); 209 TextInputClientMsg_StringForRange::ID));
210 } 210 }
211 211
212 } // namespace 212 } // namespace
OLDNEW
« no previous file with comments | « content/browser/renderer_host/test_render_view_host.cc ('k') | content/browser/site_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698