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 "base/strings/string_number_conversions.h" | 5 #include "base/strings/string_number_conversions.h" |
6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "chrome/browser/media_galleries/media_galleries_dialog_controller_mock.
h" | 7 #include "chrome/browser/media_galleries/media_galleries_dialog_controller_mock.
h" |
8 #include "chrome/browser/ui/views/extensions/media_galleries_dialog_views.h" | 8 #include "chrome/browser/ui/views/extensions/media_galleries_dialog_views.h" |
9 #include "chrome/browser/ui/views/extensions/media_gallery_checkbox_view.h" | 9 #include "chrome/browser/ui/views/extensions/media_gallery_checkbox_view.h" |
10 #include "components/storage_monitor/storage_info.h" | 10 #include "components/storage_monitor/storage_info.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 attached_permissions.push_back( | 88 attached_permissions.push_back( |
89 MediaGalleriesDialogController::Entry(MakePrefInfoForTesting(1), true)); | 89 MediaGalleriesDialogController::Entry(MakePrefInfoForTesting(1), true)); |
90 EXPECT_CALL(*controller(), GetSectionEntries(0)). | 90 EXPECT_CALL(*controller(), GetSectionEntries(0)). |
91 WillRepeatedly(Return(attached_permissions)); | 91 WillRepeatedly(Return(attached_permissions)); |
92 | 92 |
93 MediaGalleriesDialogViews dialog(controller()); | 93 MediaGalleriesDialogViews dialog(controller()); |
94 EXPECT_EQ(1U, dialog.checkbox_map_.size()); | 94 EXPECT_EQ(1U, dialog.checkbox_map_.size()); |
95 views::Checkbox* checkbox = dialog.checkbox_map_[1]->checkbox(); | 95 views::Checkbox* checkbox = dialog.checkbox_map_[1]->checkbox(); |
96 EXPECT_TRUE(checkbox->checked()); | 96 EXPECT_TRUE(checkbox->checked()); |
97 | 97 |
98 ui::KeyEvent dummy_event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE, false); | 98 ui::KeyEvent dummy_event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE); |
99 EXPECT_CALL(*controller(), DidToggleEntry(1, false)); | 99 EXPECT_CALL(*controller(), DidToggleEntry(1, false)); |
100 checkbox->SetChecked(false); | 100 checkbox->SetChecked(false); |
101 dialog.ButtonPressed(checkbox, dummy_event); | 101 dialog.ButtonPressed(checkbox, dummy_event); |
102 | 102 |
103 EXPECT_CALL(*controller(), DidToggleEntry(1, true)); | 103 EXPECT_CALL(*controller(), DidToggleEntry(1, true)); |
104 checkbox->SetChecked(true); | 104 checkbox->SetChecked(true); |
105 dialog.ButtonPressed(checkbox, dummy_event); | 105 dialog.ButtonPressed(checkbox, dummy_event); |
106 } | 106 } |
107 | 107 |
108 // Tests that UpdateGallery will add a new checkbox, but only if it refers to | 108 // Tests that UpdateGallery will add a new checkbox, but only if it refers to |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 MediaGalleryPrefInfo gallery2 = MakePrefInfoForTesting(2); | 152 MediaGalleryPrefInfo gallery2 = MakePrefInfoForTesting(2); |
153 attached_permissions.push_back( | 153 attached_permissions.push_back( |
154 MediaGalleriesDialogController::Entry(gallery2, true)); | 154 MediaGalleriesDialogController::Entry(gallery2, true)); |
155 dialog.UpdateGalleries(); | 155 dialog.UpdateGalleries(); |
156 EXPECT_EQ(2U, dialog.checkbox_map_.size()); | 156 EXPECT_EQ(2U, dialog.checkbox_map_.size()); |
157 | 157 |
158 attached_permissions.pop_back(); | 158 attached_permissions.pop_back(); |
159 dialog.UpdateGalleries(); | 159 dialog.UpdateGalleries(); |
160 EXPECT_EQ(1U, dialog.checkbox_map_.size()); | 160 EXPECT_EQ(1U, dialog.checkbox_map_.size()); |
161 } | 161 } |
OLD | NEW |