OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "chrome/browser/ui/views/global_error_bubble_view.h" | 5 #include "chrome/browser/ui/views/global_error_bubble_view.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "chrome/browser/ui/global_error/global_error.h" | 10 #include "chrome/browser/ui/global_error/global_error.h" |
11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "ui/gfx/codec/png_codec.h" | 13 #include "ui/gfx/codec/png_codec.h" |
14 #include "ui/gfx/image/image.h" | 14 #include "ui/gfx/image/image.h" |
15 #include "ui/gfx/image/image_png_rep.h" | 15 #include "ui/gfx/image/image_png_rep.h" |
16 #include "ui/gfx/image/image_unittest_util.h" | 16 #include "ui/gfx/image/image_unittest_util.h" |
17 #include "ui/views/controls/button/button.h" | 17 #include "ui/views/controls/button/button.h" |
18 #include "ui/views/controls/button/label_button.h" | 18 #include "ui/views/controls/button/label_button.h" |
| 19 #include "ui/views/test/test_views_delegate.h" |
19 | 20 |
20 using ::testing::_; | 21 using ::testing::_; |
21 using ::testing::Return; | 22 using ::testing::Return; |
22 using ::testing::StrictMock; | 23 using ::testing::StrictMock; |
23 | 24 |
24 namespace views { | 25 namespace views { |
25 class FakeButtonListener : public views::ButtonListener { | 26 class FakeButtonListener : public views::ButtonListener { |
26 public: | 27 public: |
27 FakeButtonListener() {} | 28 FakeButtonListener() {} |
28 ~FakeButtonListener() override; | 29 ~FakeButtonListener() override; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 base::MakeUnique<StrictMock<MockGlobalErrorWithStandardBubble>>()), | 81 base::MakeUnique<StrictMock<MockGlobalErrorWithStandardBubble>>()), |
81 button_(&mock_button_listener_, base::string16()), | 82 button_(&mock_button_listener_, base::string16()), |
82 view_(base::MakeUnique<GlobalErrorBubbleView>( | 83 view_(base::MakeUnique<GlobalErrorBubbleView>( |
83 &arg_view_, | 84 &arg_view_, |
84 anchor_point_, | 85 anchor_point_, |
85 arrow_, | 86 arrow_, |
86 nullptr, | 87 nullptr, |
87 mock_global_error_with_standard_bubble_->AsWeakPtr())) {} | 88 mock_global_error_with_standard_bubble_->AsWeakPtr())) {} |
88 | 89 |
89 protected: | 90 protected: |
| 91 views::TestViewsDelegate views_delegate_; |
90 std::unique_ptr<StrictMock<MockGlobalErrorWithStandardBubble>> | 92 std::unique_ptr<StrictMock<MockGlobalErrorWithStandardBubble>> |
91 mock_global_error_with_standard_bubble_; | 93 mock_global_error_with_standard_bubble_; |
92 views::View arg_view_; | 94 views::View arg_view_; |
93 const gfx::Point anchor_point_; | 95 const gfx::Point anchor_point_; |
94 views::BubbleBorder::Arrow arrow_; | 96 views::BubbleBorder::Arrow arrow_; |
95 FakeButtonListener mock_button_listener_; | 97 FakeButtonListener mock_button_listener_; |
96 views::LabelButton button_; | 98 views::LabelButton button_; |
97 std::unique_ptr<GlobalErrorBubbleView> view_; | 99 std::unique_ptr<GlobalErrorBubbleView> view_; |
98 | 100 |
99 private: | 101 private: |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 view_->GetDialogButtonLabel(ui::DIALOG_BUTTON_OK)); | 165 view_->GetDialogButtonLabel(ui::DIALOG_BUTTON_OK)); |
164 EXPECT_EQ(base::string16(), | 166 EXPECT_EQ(base::string16(), |
165 view_->GetDialogButtonLabel(ui::DIALOG_BUTTON_CANCEL)); | 167 view_->GetDialogButtonLabel(ui::DIALOG_BUTTON_CANCEL)); |
166 EXPECT_EQ(ui::DIALOG_BUTTON_NONE, view_->GetDialogButtons()); | 168 EXPECT_EQ(ui::DIALOG_BUTTON_NONE, view_->GetDialogButtons()); |
167 | 169 |
168 view_->Cancel(); | 170 view_->Cancel(); |
169 view_->Accept(); | 171 view_->Accept(); |
170 } | 172 } |
171 | 173 |
172 } // namespace views | 174 } // namespace views |
OLD | NEW |