| 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 #import "chrome/browser/ui/cocoa/confirm_bubble_controller.h" | 5 #import "chrome/browser/ui/cocoa/confirm_bubble_controller.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 return (ConfirmBubbleCocoa*)[controller_ view]; | 120 return (ConfirmBubbleCocoa*)[controller_ view]; |
| 121 } | 121 } |
| 122 | 122 |
| 123 bool model_deleted() const { return model_deleted_; } | 123 bool model_deleted() const { return model_deleted_; } |
| 124 bool accept_clicked() const { return accept_clicked_; } | 124 bool accept_clicked() const { return accept_clicked_; } |
| 125 bool cancel_clicked() const { return cancel_clicked_; } | 125 bool cancel_clicked() const { return cancel_clicked_; } |
| 126 bool link_clicked() const { return link_clicked_; } | 126 bool link_clicked() const { return link_clicked_; } |
| 127 | 127 |
| 128 private: | 128 private: |
| 129 ConfirmBubbleController* controller_; // weak; owns self | 129 ConfirmBubbleController* controller_; // weak; owns self |
| 130 scoped_ptr<TestConfirmBubbleModel> model_; | 130 std::unique_ptr<TestConfirmBubbleModel> model_; |
| 131 bool model_deleted_; | 131 bool model_deleted_; |
| 132 bool accept_clicked_; | 132 bool accept_clicked_; |
| 133 bool cancel_clicked_; | 133 bool cancel_clicked_; |
| 134 bool link_clicked_; | 134 bool link_clicked_; |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 // Verify clicking a button or a link removes the ConfirmBubbleCocoa object and | 137 // Verify clicking a button or a link removes the ConfirmBubbleCocoa object and |
| 138 // calls an appropriate model method. | 138 // calls an appropriate model method. |
| 139 TEST_F(ConfirmBubbleControllerTest, ClickOk) { | 139 TEST_F(ConfirmBubbleControllerTest, ClickOk) { |
| 140 NSView* view = [test_window() contentView]; | 140 NSView* view = [test_window() contentView]; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 // Click its link and verify this view has been removed from the test window. | 179 // Click its link and verify this view has been removed from the test window. |
| 180 // Also verify TestConfirmBubbleModel::LinkClicked() has been called. | 180 // Also verify TestConfirmBubbleModel::LinkClicked() has been called. |
| 181 [bubble clickLink]; | 181 [bubble clickLink]; |
| 182 | 182 |
| 183 contains_bubble_view = [[view subviews] containsObject:bubble]; | 183 contains_bubble_view = [[view subviews] containsObject:bubble]; |
| 184 EXPECT_FALSE(contains_bubble_view); | 184 EXPECT_FALSE(contains_bubble_view); |
| 185 EXPECT_FALSE(accept_clicked()); | 185 EXPECT_FALSE(accept_clicked()); |
| 186 EXPECT_FALSE(cancel_clicked()); | 186 EXPECT_FALSE(cancel_clicked()); |
| 187 EXPECT_TRUE(link_clicked()); | 187 EXPECT_TRUE(link_clicked()); |
| 188 } | 188 } |
| OLD | NEW |