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/macros.h" | 5 #include "base/macros.h" |
6 #include "base/strings/string_number_conversions.h" | 6 #include "base/strings/string_number_conversions.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/media_galleries/media_galleries_dialog_controller_mock.
h" | 8 #include "chrome/browser/media_galleries/media_galleries_dialog_controller_mock.
h" |
9 #include "chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa.h" | 9 #include "chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa.h" |
10 #include "components/storage_monitor/storage_info.h" | 10 #include "components/storage_monitor/storage_info.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 if (!dialog_.get()) { | 76 if (!dialog_.get()) { |
77 dialog_.reset(static_cast<MediaGalleriesDialogCocoa*>( | 77 dialog_.reset(static_cast<MediaGalleriesDialogCocoa*>( |
78 MediaGalleriesDialog::Create(&controller_))); | 78 MediaGalleriesDialog::Create(&controller_))); |
79 } | 79 } |
80 return dialog_.get(); | 80 return dialog_.get(); |
81 } | 81 } |
82 | 82 |
83 private: | 83 private: |
84 NiceMock<MediaGalleriesDialogControllerMock> controller_; | 84 NiceMock<MediaGalleriesDialogControllerMock> controller_; |
85 | 85 |
86 scoped_ptr<MediaGalleriesDialogCocoa> dialog_; | 86 std::unique_ptr<MediaGalleriesDialogCocoa> dialog_; |
87 | 87 |
88 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogTest); | 88 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogTest); |
89 }; | 89 }; |
90 | 90 |
91 // Tests that checkboxes are initialized according to the contents of | 91 // Tests that checkboxes are initialized according to the contents of |
92 // permissions(). | 92 // permissions(). |
93 TEST_F(MediaGalleriesDialogTest, InitializeCheckboxes) { | 93 TEST_F(MediaGalleriesDialogTest, InitializeCheckboxes) { |
94 MediaGalleriesDialogController::Entries attached_permissions; | 94 MediaGalleriesDialogController::Entries attached_permissions; |
95 attached_permissions.push_back( | 95 attached_permissions.push_back( |
96 MediaGalleriesDialogController::Entry(MakePrefInfoForTesting(1), true)); | 96 MediaGalleriesDialogController::Entry(MakePrefInfoForTesting(1), true)); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // Remove a gallery. | 201 // Remove a gallery. |
202 attached_permissions.erase(attached_permissions.begin()); | 202 attached_permissions.erase(attached_permissions.begin()); |
203 GetOrCreateDialog()->UpdateGalleries(); | 203 GetOrCreateDialog()->UpdateGalleries(); |
204 EXPECT_EQ(1U, [[GetOrCreateDialog()->checkbox_container_ subviews] count]); | 204 EXPECT_EQ(1U, [[GetOrCreateDialog()->checkbox_container_ subviews] count]); |
205 | 205 |
206 // The checkbox container should be shorter. | 206 // The checkbox container should be shorter. |
207 CGFloat new_container_height = | 207 CGFloat new_container_height = |
208 NSHeight([GetOrCreateDialog()->checkbox_container_ frame]); | 208 NSHeight([GetOrCreateDialog()->checkbox_container_ frame]); |
209 EXPECT_LT(new_container_height, old_container_height); | 209 EXPECT_LT(new_container_height, old_container_height); |
210 } | 210 } |
OLD | NEW |