| 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 #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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 247 | 247 | 
| 248   void SetUp() override { | 248   void SetUp() override { | 
| 249     RenderViewHostImplTestHarness::SetUp(); | 249     RenderViewHostImplTestHarness::SetUp(); | 
| 250     // TestRenderViewHost's destruction assumes that its view is a | 250     // TestRenderViewHost's destruction assumes that its view is a | 
| 251     // TestRenderWidgetHostView, so store its view and reset it back to the | 251     // TestRenderWidgetHostView, so store its view and reset it back to the | 
| 252     // stored view in |TearDown()|. | 252     // stored view in |TearDown()|. | 
| 253     old_rwhv_ = rvh()->GetWidget()->GetView(); | 253     old_rwhv_ = rvh()->GetWidget()->GetView(); | 
| 254 | 254 | 
| 255     // Owned by its |cocoa_view()|, i.e. |rwhv_cocoa_|. | 255     // Owned by its |cocoa_view()|, i.e. |rwhv_cocoa_|. | 
| 256     rwhv_mac_ = new RenderWidgetHostViewMac(rvh()->GetWidget(), false); | 256     rwhv_mac_ = new RenderWidgetHostViewMac(rvh()->GetWidget(), false); | 
|  | 257     RenderWidgetHostImpl::From(rvh()->GetWidget())->SetView(rwhv_mac_); | 
|  | 258 | 
| 257     rwhv_cocoa_.reset([rwhv_mac_->cocoa_view() retain]); | 259     rwhv_cocoa_.reset([rwhv_mac_->cocoa_view() retain]); | 
| 258   } | 260   } | 
| 259   void TearDown() override { | 261   void TearDown() override { | 
| 260     // Make sure the rwhv_mac_ is gone once the superclass's |TearDown()| runs. | 262     // Make sure the rwhv_mac_ is gone once the superclass's |TearDown()| runs. | 
| 261     rwhv_cocoa_.reset(); | 263     rwhv_cocoa_.reset(); | 
| 262     RecycleAndWait(); | 264     RecycleAndWait(); | 
| 263 | 265 | 
| 264     // See comment in SetUp(). | 266     // See comment in SetUp(). | 
| 265     test_rvh()->GetWidget()->SetView( | 267     test_rvh()->GetWidget()->SetView( | 
| 266         static_cast<RenderWidgetHostViewBase*>(old_rwhv_)); | 268         static_cast<RenderWidgetHostViewBase*>(old_rwhv_)); | 
| (...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1449   // Repeat for the tab's view. | 1451   // Repeat for the tab's view. | 
| 1450   [rwhv_cocoa_ setMarkedText:text | 1452   [rwhv_cocoa_ setMarkedText:text | 
| 1451                selectedRange:selectedRange | 1453                selectedRange:selectedRange | 
| 1452             replacementRange:replacementRange]; | 1454             replacementRange:replacementRange]; | 
| 1453   EXPECT_TRUE([rwhv_cocoa_ hasMarkedText]); | 1455   EXPECT_TRUE([rwhv_cocoa_ hasMarkedText]); | 
| 1454   rwhv_mac_->ImeCancelComposition(); | 1456   rwhv_mac_->ImeCancelComposition(); | 
| 1455   EXPECT_FALSE([rwhv_cocoa_ hasMarkedText]); | 1457   EXPECT_FALSE([rwhv_cocoa_ hasMarkedText]); | 
| 1456 } | 1458 } | 
| 1457 | 1459 | 
| 1458 }  // namespace content | 1460 }  // namespace content | 
| OLD | NEW | 
|---|