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

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

Issue 2240553003: Track text selection on the browser side (Mac) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed the failing tests on 'mac_chromium_rel_ng' Created 4 years, 4 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 #include "content/browser/renderer_host/render_widget_host_view_mac.h" 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #include <Cocoa/Cocoa.h> 7 #include <Cocoa/Cocoa.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <tuple> 10 #include <tuple>
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 245
246 void SetUp() override { 246 void SetUp() override {
247 RenderViewHostImplTestHarness::SetUp(); 247 RenderViewHostImplTestHarness::SetUp();
248 // TestRenderViewHost's destruction assumes that its view is a 248 // TestRenderViewHost's destruction assumes that its view is a
249 // TestRenderWidgetHostView, so store its view and reset it back to the 249 // TestRenderWidgetHostView, so store its view and reset it back to the
250 // stored view in |TearDown()|. 250 // stored view in |TearDown()|.
251 old_rwhv_ = rvh()->GetWidget()->GetView(); 251 old_rwhv_ = rvh()->GetWidget()->GetView();
252 252
253 // Owned by its |cocoa_view()|, i.e. |rwhv_cocoa_|. 253 // Owned by its |cocoa_view()|, i.e. |rwhv_cocoa_|.
254 rwhv_mac_ = new RenderWidgetHostViewMac(rvh()->GetWidget(), false); 254 rwhv_mac_ = new RenderWidgetHostViewMac(rvh()->GetWidget(), false);
255 RenderWidgetHostImpl::From(rvh()->GetWidget())->SetView(rwhv_mac_);
256
255 rwhv_cocoa_.reset([rwhv_mac_->cocoa_view() retain]); 257 rwhv_cocoa_.reset([rwhv_mac_->cocoa_view() retain]);
256 } 258 }
257 void TearDown() override { 259 void TearDown() override {
258 // Make sure the rwhv_mac_ is gone once the superclass's |TearDown()| runs. 260 // Make sure the rwhv_mac_ is gone once the superclass's |TearDown()| runs.
259 rwhv_cocoa_.reset(); 261 rwhv_cocoa_.reset();
260 RecycleAndWait(); 262 RecycleAndWait();
261 263
262 // See comment in SetUp(). 264 // See comment in SetUp().
263 test_rvh()->GetWidget()->SetView( 265 test_rvh()->GetWidget()->SetView(
264 static_cast<RenderWidgetHostViewBase*>(old_rwhv_)); 266 static_cast<RenderWidgetHostViewBase*>(old_rwhv_));
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 // Repeat for the tab's view. 1270 // Repeat for the tab's view.
1269 [rwhv_cocoa_ setMarkedText:text 1271 [rwhv_cocoa_ setMarkedText:text
1270 selectedRange:selectedRange 1272 selectedRange:selectedRange
1271 replacementRange:replacementRange]; 1273 replacementRange:replacementRange];
1272 EXPECT_TRUE([rwhv_cocoa_ hasMarkedText]); 1274 EXPECT_TRUE([rwhv_cocoa_ hasMarkedText]);
1273 rwhv_mac_->ImeCancelComposition(); 1275 rwhv_mac_->ImeCancelComposition();
1274 EXPECT_FALSE([rwhv_cocoa_ hasMarkedText]); 1276 EXPECT_FALSE([rwhv_cocoa_ hasMarkedText]);
1275 } 1277 }
1276 1278
1277 } // namespace content 1279 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698