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 "base/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
6 #include "base/strings/string16.h" | 6 #include "base/strings/string16.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 8 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
9 #import "chrome/browser/ui/cocoa/confirm_bubble_cocoa.h" | 9 #import "chrome/browser/ui/cocoa/confirm_bubble_cocoa.h" |
10 #import "chrome/browser/ui/cocoa/confirm_bubble_controller.h" | 10 #import "chrome/browser/ui/cocoa/confirm_bubble_controller.h" |
11 #include "chrome/browser/ui/confirm_bubble_model.h" | 11 #include "chrome/browser/ui/confirm_bubble_model.h" |
12 #include "grit/theme_resources.h" | 12 #include "grit/theme_resources.h" |
13 #import "testing/gtest_mac.h" | 13 #import "testing/gtest_mac.h" |
14 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
15 #import "ui/gfx/point.h" | 15 #import "ui/gfx/point.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 // The model object used in this test. This model implements all methods and | 19 // The model object used in this test. This model implements all methods and |
20 // updates its status when ConfirmBubbleController calls its methods. | 20 // updates its status when ConfirmBubbleController calls its methods. |
21 class TestConfirmBubbleModel : public ConfirmBubbleModel { | 21 class TestConfirmBubbleModel : public ConfirmBubbleModel { |
22 public: | 22 public: |
23 TestConfirmBubbleModel(bool* model_deleted, | 23 TestConfirmBubbleModel(bool* model_deleted, |
24 bool* accept_clicked, | 24 bool* accept_clicked, |
25 bool* cancel_clicked, | 25 bool* cancel_clicked, |
26 bool* link_clicked); | 26 bool* link_clicked); |
27 TestConfirmBubbleModel(); | 27 TestConfirmBubbleModel(); |
28 virtual ~TestConfirmBubbleModel() OVERRIDE; | 28 virtual ~TestConfirmBubbleModel() override; |
29 virtual base::string16 GetTitle() const OVERRIDE; | 29 virtual base::string16 GetTitle() const override; |
30 virtual base::string16 GetMessageText() const OVERRIDE; | 30 virtual base::string16 GetMessageText() const override; |
31 virtual gfx::Image* GetIcon() const OVERRIDE; | 31 virtual gfx::Image* GetIcon() const override; |
32 virtual int GetButtons() const OVERRIDE; | 32 virtual int GetButtons() const override; |
33 virtual base::string16 GetButtonLabel(BubbleButton button) const OVERRIDE; | 33 virtual base::string16 GetButtonLabel(BubbleButton button) const override; |
34 virtual void Accept() OVERRIDE; | 34 virtual void Accept() override; |
35 virtual void Cancel() OVERRIDE; | 35 virtual void Cancel() override; |
36 virtual base::string16 GetLinkText() const OVERRIDE; | 36 virtual base::string16 GetLinkText() const override; |
37 virtual void LinkClicked() OVERRIDE; | 37 virtual void LinkClicked() override; |
38 | 38 |
39 private: | 39 private: |
40 bool* model_deleted_; | 40 bool* model_deleted_; |
41 bool* accept_clicked_; | 41 bool* accept_clicked_; |
42 bool* cancel_clicked_; | 42 bool* cancel_clicked_; |
43 bool* link_clicked_; | 43 bool* link_clicked_; |
44 }; | 44 }; |
45 | 45 |
46 TestConfirmBubbleModel::TestConfirmBubbleModel(bool* model_deleted, | 46 TestConfirmBubbleModel::TestConfirmBubbleModel(bool* model_deleted, |
47 bool* accept_clicked, | 47 bool* accept_clicked, |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 // Click its link and verify this view has been removed from the test window. | 185 // Click its link and verify this view has been removed from the test window. |
186 // Also verify TestConfirmBubbleModel::LinkClicked() has been called. | 186 // Also verify TestConfirmBubbleModel::LinkClicked() has been called. |
187 [bubble clickLink]; | 187 [bubble clickLink]; |
188 | 188 |
189 contains_bubble_view = [[view subviews] containsObject:bubble]; | 189 contains_bubble_view = [[view subviews] containsObject:bubble]; |
190 EXPECT_FALSE(contains_bubble_view); | 190 EXPECT_FALSE(contains_bubble_view); |
191 EXPECT_FALSE(accept_clicked()); | 191 EXPECT_FALSE(accept_clicked()); |
192 EXPECT_FALSE(cancel_clicked()); | 192 EXPECT_FALSE(cancel_clicked()); |
193 EXPECT_TRUE(link_clicked()); | 193 EXPECT_TRUE(link_clicked()); |
194 } | 194 } |
OLD | NEW |