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 #include <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/media_galleries/media_galleries_dialog_controller_mock.
h" | 10 #include "chrome/browser/media_galleries/media_galleries_dialog_controller_mock.
h" |
11 #include "chrome/browser/ui/views/extensions/media_galleries_dialog_views.h" | 11 #include "chrome/browser/ui/views/extensions/media_galleries_dialog_views.h" |
12 #include "chrome/browser/ui/views/extensions/media_gallery_checkbox_view.h" | 12 #include "chrome/browser/ui/views/extensions/media_gallery_checkbox_view.h" |
13 #include "components/storage_monitor/storage_info.h" | 13 #include "components/storage_monitor/storage_info.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "ui/views/controls/button/checkbox.h" | 15 #include "ui/views/controls/button/checkbox.h" |
| 16 #include "ui/views/test/test_views_delegate.h" |
16 | 17 |
17 using ::testing::_; | 18 using ::testing::_; |
18 using ::testing::AnyNumber; | 19 using ::testing::AnyNumber; |
19 using ::testing::Mock; | 20 using ::testing::Mock; |
20 using ::testing::NiceMock; | 21 using ::testing::NiceMock; |
21 using ::testing::Return; | 22 using ::testing::Return; |
22 using ::testing::ReturnPointee; | 23 using ::testing::ReturnPointee; |
23 | 24 |
24 namespace { | 25 namespace { |
25 | 26 |
(...skipping 27 matching lines...) Expand all Loading... |
53 Mock::VerifyAndClearExpectations(&controller_); | 54 Mock::VerifyAndClearExpectations(&controller_); |
54 } | 55 } |
55 | 56 |
56 NiceMock<MediaGalleriesDialogControllerMock>* controller() { | 57 NiceMock<MediaGalleriesDialogControllerMock>* controller() { |
57 return &controller_; | 58 return &controller_; |
58 } | 59 } |
59 | 60 |
60 private: | 61 private: |
61 // TODO(gbillock): Get rid of this mock; make something specialized. | 62 // TODO(gbillock): Get rid of this mock; make something specialized. |
62 NiceMock<MediaGalleriesDialogControllerMock> controller_; | 63 NiceMock<MediaGalleriesDialogControllerMock> controller_; |
| 64 views::TestViewsDelegate views_delegate_; |
63 | 65 |
64 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogTest); | 66 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogTest); |
65 }; | 67 }; |
66 | 68 |
67 // Tests that checkboxes are initialized according to the contents of | 69 // Tests that checkboxes are initialized according to the contents of |
68 // permissions in the registry. | 70 // permissions in the registry. |
69 TEST_F(MediaGalleriesDialogTest, InitializeCheckboxes) { | 71 TEST_F(MediaGalleriesDialogTest, InitializeCheckboxes) { |
70 MediaGalleriesDialogController::Entries attached_permissions; | 72 MediaGalleriesDialogController::Entries attached_permissions; |
71 attached_permissions.push_back( | 73 attached_permissions.push_back( |
72 MediaGalleriesDialogController::Entry(MakePrefInfoForTesting(1), true)); | 74 MediaGalleriesDialogController::Entry(MakePrefInfoForTesting(1), true)); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 MediaGalleryPrefInfo gallery2 = MakePrefInfoForTesting(2); | 157 MediaGalleryPrefInfo gallery2 = MakePrefInfoForTesting(2); |
156 attached_permissions.push_back( | 158 attached_permissions.push_back( |
157 MediaGalleriesDialogController::Entry(gallery2, true)); | 159 MediaGalleriesDialogController::Entry(gallery2, true)); |
158 dialog.UpdateGalleries(); | 160 dialog.UpdateGalleries(); |
159 EXPECT_EQ(2U, dialog.checkbox_map_.size()); | 161 EXPECT_EQ(2U, dialog.checkbox_map_.size()); |
160 | 162 |
161 attached_permissions.pop_back(); | 163 attached_permissions.pop_back(); |
162 dialog.UpdateGalleries(); | 164 dialog.UpdateGalleries(); |
163 EXPECT_EQ(1U, dialog.checkbox_map_.size()); | 165 EXPECT_EQ(1U, dialog.checkbox_map_.size()); |
164 } | 166 } |
OLD | NEW |