| OLD | NEW |
| 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 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| 11 #import "base/mac/foundation_util.h" | 11 #import "base/mac/foundation_util.h" |
| 12 #import "base/mac/mac_util.h" | 12 #import "base/mac/mac_util.h" |
| 13 #import "base/mac/sdk_forward_declarations.h" | 13 #import "base/mac/sdk_forward_declarations.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/message_loop/message_loop.h" | |
| 16 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 17 #include "base/strings/sys_string_conversions.h" | 16 #include "base/strings/sys_string_conversions.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "base/test/scoped_task_environment.h" |
| 19 #import "testing/gtest_mac.h" | 19 #import "testing/gtest_mac.h" |
| 20 #import "ui/base/cocoa/window_size_constants.h" | 20 #import "ui/base/cocoa/window_size_constants.h" |
| 21 #include "ui/base/ime/input_method.h" | 21 #include "ui/base/ime/input_method.h" |
| 22 #include "ui/base/material_design/material_design_controller.h" | 22 #include "ui/base/material_design/material_design_controller.h" |
| 23 #include "ui/base/test/material_design_controller_test_api.h" | 23 #include "ui/base/test/material_design_controller_test_api.h" |
| 24 #include "ui/events/test/cocoa_test_event_utils.h" | 24 #include "ui/events/test/cocoa_test_event_utils.h" |
| 25 #import "ui/gfx/mac/coordinate_conversion.h" | 25 #import "ui/gfx/mac/coordinate_conversion.h" |
| 26 #import "ui/gfx/test/ui_cocoa_test_helper.h" | 26 #import "ui/gfx/test/ui_cocoa_test_helper.h" |
| 27 #import "ui/views/cocoa/bridged_content_view.h" | 27 #import "ui/views/cocoa/bridged_content_view.h" |
| 28 #import "ui/views/cocoa/native_widget_mac_nswindow.h" | 28 #import "ui/views/cocoa/native_widget_mac_nswindow.h" |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 void TestEditingCommands(NSArray* selectors, TestCase cases = TestCase::ALL); | 355 void TestEditingCommands(NSArray* selectors, TestCase cases = TestCase::ALL); |
| 356 | 356 |
| 357 std::unique_ptr<views::View> view_; | 357 std::unique_ptr<views::View> view_; |
| 358 | 358 |
| 359 // Weak. Owned by bridge(). | 359 // Weak. Owned by bridge(). |
| 360 BridgedContentView* ns_view_; | 360 BridgedContentView* ns_view_; |
| 361 | 361 |
| 362 // An NSTextView which helps set the expectations for our tests. | 362 // An NSTextView which helps set the expectations for our tests. |
| 363 base::scoped_nsobject<NSTextView> dummy_text_view_; | 363 base::scoped_nsobject<NSTextView> dummy_text_view_; |
| 364 | 364 |
| 365 base::MessageLoopForUI message_loop_; | 365 base::test::ScopedTaskEnvironment scoped_task_environment_; |
| 366 | 366 |
| 367 private: | 367 private: |
| 368 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidgetTest); | 368 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidgetTest); |
| 369 }; | 369 }; |
| 370 | 370 |
| 371 BridgedNativeWidgetTest::BridgedNativeWidgetTest() { | 371 BridgedNativeWidgetTest::BridgedNativeWidgetTest() |
| 372 } | 372 : scoped_task_environment_( |
| 373 base::test::ScopedTaskEnvironment::MainThreadType::UI) {} |
| 373 | 374 |
| 374 BridgedNativeWidgetTest::~BridgedNativeWidgetTest() { | 375 BridgedNativeWidgetTest::~BridgedNativeWidgetTest() { |
| 375 } | 376 } |
| 376 | 377 |
| 377 void BridgedNativeWidgetTest::InstallTextField( | 378 void BridgedNativeWidgetTest::InstallTextField( |
| 378 const base::string16& text, | 379 const base::string16& text, |
| 379 ui::TextInputType text_input_type) { | 380 ui::TextInputType text_input_type) { |
| 380 Textfield* textfield = new Textfield(); | 381 Textfield* textfield = new Textfield(); |
| 381 textfield->SetText(text); | 382 textfield->SetText(text); |
| 382 textfield->SetTextInputType(text_input_type); | 383 textfield->SetTextInputType(text_input_type); |
| (...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 [center postNotificationName:NSWindowDidExitFullScreenNotification | 1324 [center postNotificationName:NSWindowDidExitFullScreenNotification |
| 1324 object:window]; | 1325 object:window]; |
| 1325 EXPECT_EQ(1, [window ignoredToggleFullScreenCount]); // No change. | 1326 EXPECT_EQ(1, [window ignoredToggleFullScreenCount]); // No change. |
| 1326 EXPECT_FALSE(bridge()->target_fullscreen_state()); | 1327 EXPECT_FALSE(bridge()->target_fullscreen_state()); |
| 1327 | 1328 |
| 1328 widget_->CloseNow(); | 1329 widget_->CloseNow(); |
| 1329 } | 1330 } |
| 1330 | 1331 |
| 1331 } // namespace test | 1332 } // namespace test |
| 1332 } // namespace views | 1333 } // namespace views |
| OLD | NEW |