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

Side by Side Diff: ui/views/cocoa/bridged_native_widget_unittest.mm

Issue 1177503003: Remove the 2-level input method system & InputMethodBridge. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits. Created 5 years, 5 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
« no previous file with comments | « ui/views/cocoa/bridged_native_widget.mm ('k') | ui/views/controls/combobox/combobox.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/views/cocoa/bridged_native_widget.h" 5 #import "ui/views/cocoa/bridged_native_widget.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #import "base/mac/foundation_util.h" 9 #import "base/mac/foundation_util.h"
10 #import "base/mac/mac_util.h" 10 #import "base/mac/mac_util.h"
11 #import "base/mac/sdk_forward_declarations.h" 11 #import "base/mac/sdk_forward_declarations.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/strings/sys_string_conversions.h" 14 #include "base/strings/sys_string_conversions.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #import "testing/gtest_mac.h" 16 #import "testing/gtest_mac.h"
17 #include "ui/base/ime/input_method.h"
17 #import "ui/gfx/test/ui_cocoa_test_helper.h" 18 #import "ui/gfx/test/ui_cocoa_test_helper.h"
18 #import "ui/views/cocoa/bridged_content_view.h" 19 #import "ui/views/cocoa/bridged_content_view.h"
19 #import "ui/views/cocoa/native_widget_mac_nswindow.h" 20 #import "ui/views/cocoa/native_widget_mac_nswindow.h"
20 #import "ui/views/cocoa/views_nswindow_delegate.h" 21 #import "ui/views/cocoa/views_nswindow_delegate.h"
21 #include "ui/views/controls/textfield/textfield.h" 22 #include "ui/views/controls/textfield/textfield.h"
22 #include "ui/views/ime/input_method.h"
23 #include "ui/views/view.h" 23 #include "ui/views/view.h"
24 #include "ui/views/widget/native_widget_mac.h" 24 #include "ui/views/widget/native_widget_mac.h"
25 #include "ui/views/widget/root_view.h" 25 #include "ui/views/widget/root_view.h"
26 #include "ui/views/widget/widget.h" 26 #include "ui/views/widget/widget.h"
27 #include "ui/views/widget/widget_observer.h" 27 #include "ui/views/widget/widget_observer.h"
28 28
29 using base::ASCIIToUTF16; 29 using base::ASCIIToUTF16;
30 using base::SysNSStringToUTF8; 30 using base::SysNSStringToUTF8;
31 using base::SysNSStringToUTF16; 31 using base::SysNSStringToUTF16;
32 using base::SysUTF8ToNSString; 32 using base::SysUTF8ToNSString;
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 // Make sure a resize actually occurs. 261 // Make sure a resize actually occurs.
262 EXPECT_NE(kTestNewWidth, view_->width()); 262 EXPECT_NE(kTestNewWidth, view_->width());
263 EXPECT_NE(kTestNewHeight, view_->height()); 263 EXPECT_NE(kTestNewHeight, view_->height());
264 264
265 [test_window() setFrame:NSMakeRect(0, 0, kTestNewWidth, kTestNewHeight) 265 [test_window() setFrame:NSMakeRect(0, 0, kTestNewWidth, kTestNewHeight)
266 display:NO]; 266 display:NO];
267 EXPECT_EQ(kTestNewWidth, view_->width()); 267 EXPECT_EQ(kTestNewWidth, view_->width());
268 EXPECT_EQ(kTestNewHeight, view_->height()); 268 EXPECT_EQ(kTestNewHeight, view_->height());
269 } 269 }
270 270
271 TEST_F(BridgedNativeWidgetTest, CreateInputMethodShouldNotReturnNull) { 271 TEST_F(BridgedNativeWidgetTest, GetInputMethodShouldNotReturnNull) {
272 scoped_ptr<views::InputMethod> input_method(bridge()->CreateInputMethod()); 272 EXPECT_TRUE(bridge()->GetInputMethod());
273 EXPECT_TRUE(input_method);
274 }
275
276 TEST_F(BridgedNativeWidgetTest, GetHostInputMethodShouldNotReturnNull) {
277 EXPECT_TRUE(bridge()->GetHostInputMethod());
278 } 273 }
279 274
280 // A simpler test harness for testing initialization flows. 275 // A simpler test harness for testing initialization flows.
281 typedef BridgedNativeWidgetTestBase BridgedNativeWidgetInitTest; 276 typedef BridgedNativeWidgetTestBase BridgedNativeWidgetInitTest;
282 277
283 // Test that BridgedNativeWidget remains sane if Init() is never called. 278 // Test that BridgedNativeWidget remains sane if Init() is never called.
284 TEST_F(BridgedNativeWidgetInitTest, InitNotCalled) { 279 TEST_F(BridgedNativeWidgetInitTest, InitNotCalled) {
285 EXPECT_FALSE(bridge()->ns_view()); 280 EXPECT_FALSE(bridge()->ns_view());
286 EXPECT_FALSE(bridge()->ns_window()); 281 EXPECT_FALSE(bridge()->ns_window());
287 bridge().reset(); 282 bridge().reset();
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 [center postNotificationName:NSWindowDidExitFullScreenNotification 510 [center postNotificationName:NSWindowDidExitFullScreenNotification
516 object:window]; 511 object:window];
517 EXPECT_EQ(1, [window ignoredToggleFullScreenCount]); // No change. 512 EXPECT_EQ(1, [window ignoredToggleFullScreenCount]); // No change.
518 EXPECT_FALSE(bridge()->target_fullscreen_state()); 513 EXPECT_FALSE(bridge()->target_fullscreen_state());
519 514
520 widget_->CloseNow(); 515 widget_->CloseNow();
521 } 516 }
522 517
523 } // namespace test 518 } // namespace test
524 } // namespace views 519 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/cocoa/bridged_native_widget.mm ('k') | ui/views/controls/combobox/combobox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698