| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/ui/cocoa/extensions/chooser_dialog_cocoa_controller.h" | 5 #import "chrome/browser/ui/cocoa/extensions/chooser_dialog_cocoa_controller.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #import "chrome/browser/ui/cocoa/chooser_content_view.h" | 13 #import "chrome/browser/ui/cocoa/chooser_content_view_cocoa.h" |
| 14 #import "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 14 #import "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
| 15 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 15 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 16 #import "chrome/browser/ui/cocoa/extensions/chooser_dialog_cocoa.h" | 16 #import "chrome/browser/ui/cocoa/extensions/chooser_dialog_cocoa.h" |
| 17 #include "components/chooser_controller/mock_chooser_controller.h" | 17 #include "components/chooser_controller/mock_chooser_controller.h" |
| 18 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 20 #include "testing/gtest_mac.h" | 20 #include "testing/gtest_mac.h" |
| 21 | 21 |
| 22 class ChooserDialogCocoaControllerTest : public CocoaProfileTest { | 22 class ChooserDialogCocoaControllerTest : public CocoaProfileTest { |
| 23 protected: | 23 protected: |
| (...skipping 29 matching lines...) Expand all Loading... |
| 53 cancel_button_ = [chooser_content_view_ cancelButton]; | 53 cancel_button_ = [chooser_content_view_ cancelButton]; |
| 54 ASSERT_TRUE(cancel_button_); | 54 ASSERT_TRUE(cancel_button_); |
| 55 help_button_ = [chooser_content_view_ helpButton]; | 55 help_button_ = [chooser_content_view_ helpButton]; |
| 56 ASSERT_TRUE(help_button_); | 56 ASSERT_TRUE(help_button_); |
| 57 } | 57 } |
| 58 | 58 |
| 59 std::unique_ptr<MockChooserController> chooser_controller_; | 59 std::unique_ptr<MockChooserController> chooser_controller_; |
| 60 std::unique_ptr<ChooserDialogCocoa> chooser_dialog_; | 60 std::unique_ptr<ChooserDialogCocoa> chooser_dialog_; |
| 61 | 61 |
| 62 ChooserDialogCocoaController* chooser_dialog_controller_; | 62 ChooserDialogCocoaController* chooser_dialog_controller_; |
| 63 ChooserContentView* chooser_content_view_; | 63 ChooserContentViewCocoa* chooser_content_view_; |
| 64 NSTableView* table_view_; | 64 NSTableView* table_view_; |
| 65 NSButton* connect_button_; | 65 NSButton* connect_button_; |
| 66 NSButton* cancel_button_; | 66 NSButton* cancel_button_; |
| 67 NSButton* help_button_; | 67 NSButton* help_button_; |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 DISALLOW_COPY_AND_ASSIGN(ChooserDialogCocoaControllerTest); | 70 DISALLOW_COPY_AND_ASSIGN(ChooserDialogCocoaControllerTest); |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 TEST_F(ChooserDialogCocoaControllerTest, InitialState) { | 73 TEST_F(ChooserDialogCocoaControllerTest, InitialState) { |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 chooser_controller_->OptionAdded(base::ASCIIToUTF16("c")); | 360 chooser_controller_->OptionAdded(base::ASCIIToUTF16("c")); |
| 361 | 361 |
| 362 // Select option 0 and press "Get help" button. | 362 // Select option 0 and press "Get help" button. |
| 363 [table_view_ selectRowIndexes:[NSIndexSet indexSetWithIndex:0] | 363 [table_view_ selectRowIndexes:[NSIndexSet indexSetWithIndex:0] |
| 364 byExtendingSelection:NO]; | 364 byExtendingSelection:NO]; |
| 365 EXPECT_CALL(*chooser_controller_, Select(testing::_)).Times(0); | 365 EXPECT_CALL(*chooser_controller_, Select(testing::_)).Times(0); |
| 366 EXPECT_CALL(*chooser_controller_, Cancel()).Times(0); | 366 EXPECT_CALL(*chooser_controller_, Cancel()).Times(0); |
| 367 EXPECT_CALL(*chooser_controller_, OpenHelpCenterUrl()).Times(1); | 367 EXPECT_CALL(*chooser_controller_, OpenHelpCenterUrl()).Times(1); |
| 368 [help_button_ performClick:chooser_dialog_controller_]; | 368 [help_button_ performClick:chooser_dialog_controller_]; |
| 369 } | 369 } |
| OLD | NEW |