| 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 }; | 310 }; |
| 311 | 311 |
| 312 TEST_F(RenderWidgetHostViewMacTest, Basic) { | 312 TEST_F(RenderWidgetHostViewMacTest, Basic) { |
| 313 } | 313 } |
| 314 | 314 |
| 315 TEST_F(RenderWidgetHostViewMacTest, AcceptsFirstResponder) { | 315 TEST_F(RenderWidgetHostViewMacTest, AcceptsFirstResponder) { |
| 316 // The RWHVCocoa should normally accept first responder status. | 316 // The RWHVCocoa should normally accept first responder status. |
| 317 EXPECT_TRUE([rwhv_cocoa_.get() acceptsFirstResponder]); | 317 EXPECT_TRUE([rwhv_cocoa_.get() acceptsFirstResponder]); |
| 318 } | 318 } |
| 319 | 319 |
| 320 // This test verifies that RenderWidgetHostViewCocoa's implementation of | |
| 321 // NSTextInputClientConformance conforms to requirements. | |
| 322 TEST_F(RenderWidgetHostViewMacTest, NSTextInputClientConformance) { | |
| 323 NSRange selectedRange = [rwhv_cocoa_ selectedRange]; | |
| 324 EXPECT_EQ(NSNotFound, selectedRange.location); | |
| 325 EXPECT_EQ(0u, selectedRange.length); | |
| 326 | |
| 327 NSRange actualRange = NSMakeRange(1u, 2u); | |
| 328 NSAttributedString* actualString = [rwhv_cocoa_ | |
| 329 attributedSubstringForProposedRange:NSMakeRange(NSNotFound, 0u) | |
| 330 actualRange:&actualRange]; | |
| 331 EXPECT_EQ(nil, actualString); | |
| 332 EXPECT_EQ(NSNotFound, actualRange.location); | |
| 333 EXPECT_EQ(0u, actualRange.length); | |
| 334 | |
| 335 actualString = [rwhv_cocoa_ | |
| 336 attributedSubstringForProposedRange:NSMakeRange(NSNotFound, 15u) | |
| 337 actualRange:&actualRange]; | |
| 338 EXPECT_EQ(nil, actualString); | |
| 339 EXPECT_EQ(NSNotFound, actualRange.location); | |
| 340 EXPECT_EQ(0u, actualRange.length); | |
| 341 } | |
| 342 | |
| 343 TEST_F(RenderWidgetHostViewMacTest, Fullscreen) { | 320 TEST_F(RenderWidgetHostViewMacTest, Fullscreen) { |
| 344 rwhv_mac_->InitAsFullscreen(NULL); | 321 rwhv_mac_->InitAsFullscreen(NULL); |
| 345 EXPECT_TRUE(rwhv_mac_->pepper_fullscreen_window()); | 322 EXPECT_TRUE(rwhv_mac_->pepper_fullscreen_window()); |
| 346 | 323 |
| 347 // Break the reference cycle caused by pepper_fullscreen_window() without | 324 // Break the reference cycle caused by pepper_fullscreen_window() without |
| 348 // an <esc> event. See comment in | 325 // an <esc> event. See comment in |
| 349 // release_pepper_fullscreen_window_for_testing(). | 326 // release_pepper_fullscreen_window_for_testing(). |
| 350 rwhv_mac_->release_pepper_fullscreen_window_for_testing(); | 327 rwhv_mac_->release_pepper_fullscreen_window_for_testing(); |
| 351 } | 328 } |
| 352 | 329 |
| (...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1480 // Repeat for the tab's view. | 1457 // Repeat for the tab's view. |
| 1481 [rwhv_cocoa_ setMarkedText:text | 1458 [rwhv_cocoa_ setMarkedText:text |
| 1482 selectedRange:selectedRange | 1459 selectedRange:selectedRange |
| 1483 replacementRange:replacementRange]; | 1460 replacementRange:replacementRange]; |
| 1484 EXPECT_TRUE([rwhv_cocoa_ hasMarkedText]); | 1461 EXPECT_TRUE([rwhv_cocoa_ hasMarkedText]); |
| 1485 rwhv_mac_->ImeCancelComposition(); | 1462 rwhv_mac_->ImeCancelComposition(); |
| 1486 EXPECT_FALSE([rwhv_cocoa_ hasMarkedText]); | 1463 EXPECT_FALSE([rwhv_cocoa_ hasMarkedText]); |
| 1487 } | 1464 } |
| 1488 | 1465 |
| 1489 } // namespace content | 1466 } // namespace content |
| OLD | NEW |