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

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

Issue 1359163005: Remove surface_id from RenderWidget/RenderWidgetHost and friends (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@channel_creation_preempt
Patch Set: fix more tests Created 5 years, 2 months 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
OLDNEW
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/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "content/browser/gpu/gpu_surface_tracker.h"
11 #include "content/browser/renderer_host/render_process_host_impl.h" 10 #include "content/browser/renderer_host/render_process_host_impl.h"
12 #include "content/browser/renderer_host/render_widget_host_delegate.h" 11 #include "content/browser/renderer_host/render_widget_host_delegate.h"
13 #include "content/browser/renderer_host/render_widget_host_impl.h" 12 #include "content/browser/renderer_host/render_widget_host_impl.h"
14 #include "content/browser/renderer_host/text_input_client_message_filter.h" 13 #include "content/browser/renderer_host/text_input_client_message_filter.h"
15 #include "content/common/text_input_client_messages.h" 14 #include "content/common/text_input_client_messages.h"
16 #include "content/public/test/mock_render_process_host.h" 15 #include "content/public/test/mock_render_process_host.h"
17 #include "content/public/test/test_browser_context.h" 16 #include "content/public/test/test_browser_context.h"
18 #include "ipc/ipc_test_sink.h" 17 #include "ipc/ipc_test_sink.h"
19 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
20 #include "testing/gtest_mac.h" 19 #include "testing/gtest_mac.h"
(...skipping 21 matching lines...) Expand all
42 class TextInputClientMacTest : public testing::Test { 41 class TextInputClientMacTest : public testing::Test {
43 public: 42 public:
44 TextInputClientMacTest() 43 TextInputClientMacTest()
45 : browser_context_(), 44 : browser_context_(),
46 process_factory_(), 45 process_factory_(),
47 delegate_(), 46 delegate_(),
48 thread_("TextInputClientMacTestThread") { 47 thread_("TextInputClientMacTestThread") {
49 RenderProcessHost* rph = 48 RenderProcessHost* rph =
50 process_factory_.CreateRenderProcessHost(&browser_context_, nullptr); 49 process_factory_.CreateRenderProcessHost(&browser_context_, nullptr);
51 int32 routing_id = rph->GetNextRoutingID(); 50 int32 routing_id = rph->GetNextRoutingID();
52 int32 surface_id = GpuSurfaceTracker::Get()->AddSurfaceForRenderer( 51 widget_.reset(new RenderWidgetHostImpl(&delegate_, rph, routing_id, false));
53 rph->GetID(), routing_id);
54 widget_.reset(new RenderWidgetHostImpl(&delegate_, rph, routing_id,
55 surface_id, false));
56 } 52 }
57 53
58 // Accessor for the TextInputClientMac instance. 54 // Accessor for the TextInputClientMac instance.
59 TextInputClientMac* service() { 55 TextInputClientMac* service() {
60 return TextInputClientMac::GetInstance(); 56 return TextInputClientMac::GetInstance();
61 } 57 }
62 58
63 // Helper method to post a task on the testing thread's MessageLoop after 59 // Helper method to post a task on the testing thread's MessageLoop after
64 // a short delay. 60 // a short delay.
65 void PostTask(const tracked_objects::Location& from_here, 61 void PostTask(const tracked_objects::Location& from_here,
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 194
199 TEST_F(TextInputClientMacTest, TimeoutRectForRange) { 195 TEST_F(TextInputClientMacTest, TimeoutRectForRange) {
200 NSRect rect = service()->GetFirstRectForRange(widget(), NSMakeRange(0, 32)); 196 NSRect rect = service()->GetFirstRectForRange(widget(), NSMakeRange(0, 32));
201 EXPECT_EQ(1U, ipc_sink().message_count()); 197 EXPECT_EQ(1U, ipc_sink().message_count());
202 EXPECT_TRUE(ipc_sink().GetUniqueMessageMatching( 198 EXPECT_TRUE(ipc_sink().GetUniqueMessageMatching(
203 TextInputClientMsg_FirstRectForCharacterRange::ID)); 199 TextInputClientMsg_FirstRectForCharacterRange::ID));
204 EXPECT_NSEQ(NSZeroRect, rect); 200 EXPECT_NSEQ(NSZeroRect, rect);
205 } 201 }
206 202
207 } // namespace content 203 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac_unittest.mm ('k') | content/browser/security_exploit_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698