Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Side by Side Diff: chrome/browser/media_galleries/media_galleries_permissions_unittest.cc

Issue 660343006: Standardize usage of virtual/override/final in chrome/browser/media_galleries (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "chrome/browser/extensions/./extension_prefs_unittest.h" 7 #include "chrome/browser/extensions/./extension_prefs_unittest.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/media_galleries/media_galleries_preferences.h" 9 #include "chrome/browser/media_galleries/media_galleries_preferences.h"
10 #include "chrome/browser/media_galleries/media_galleries_test_util.h" 10 #include "chrome/browser/media_galleries/media_galleries_test_util.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 gallery_prefs_->SetExtensionPrefsForTesting(prefs()); 50 gallery_prefs_->SetExtensionPrefsForTesting(prefs());
51 Verify(); 51 Verify();
52 prefs_.pref_service()->CommitPendingWrite(); 52 prefs_.pref_service()->CommitPendingWrite();
53 message_loop_.RunUntilIdle(); 53 message_loop_.RunUntilIdle();
54 54
55 storage_monitor::TestStorageMonitor::Destroy(); 55 storage_monitor::TestStorageMonitor::Destroy();
56 56
57 testing::Test::TearDown(); 57 testing::Test::TearDown();
58 } 58 }
59 59
60 virtual void Initialize() override { 60 void Initialize() override {
61 file_thread_.Start(); 61 file_thread_.Start();
62 62
63 ASSERT_TRUE(storage_monitor::TestStorageMonitor::CreateAndInstall()); 63 ASSERT_TRUE(storage_monitor::TestStorageMonitor::CreateAndInstall());
64 profile_.reset(new TestingProfile); 64 profile_.reset(new TestingProfile);
65 gallery_prefs_.reset(new MediaGalleriesPreferences(profile_.get())); 65 gallery_prefs_.reset(new MediaGalleriesPreferences(profile_.get()));
66 base::RunLoop loop; 66 base::RunLoop loop;
67 gallery_prefs_->EnsureInitialized(loop.QuitClosure()); 67 gallery_prefs_->EnsureInitialized(loop.QuitClosure());
68 loop.Run(); 68 loop.Run();
69 69
70 gallery_prefs_->SetExtensionPrefsForTesting(prefs()); 70 gallery_prefs_->SetExtensionPrefsForTesting(prefs());
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 gallery_prefs_->RemoveGalleryPermissionsFromPrefs(3); 103 gallery_prefs_->RemoveGalleryPermissionsFromPrefs(3);
104 extension2_expectation_.erase(extension2_expectation_.begin() + 1); 104 extension2_expectation_.erase(extension2_expectation_.begin() + 1);
105 extension3_expectation_.erase(extension3_expectation_.begin()); 105 extension3_expectation_.erase(extension3_expectation_.begin());
106 Verify(); 106 Verify();
107 107
108 gallery_prefs_->UnsetGalleryPermissionInPrefs(extension1_id_, 1); 108 gallery_prefs_->UnsetGalleryPermissionInPrefs(extension1_id_, 1);
109 extension1_expectation_.erase(extension1_expectation_.begin()); 109 extension1_expectation_.erase(extension1_expectation_.begin());
110 Verify(); 110 Verify();
111 } 111 }
112 112
113 virtual void Verify() override { 113 void Verify() override {
114 struct TestData { 114 struct TestData {
115 std::string* id; 115 std::string* id;
116 std::vector<MediaGalleryPermission>* expectation; 116 std::vector<MediaGalleryPermission>* expectation;
117 }; 117 };
118 118
119 const TestData test_data[] = {{&extension1_id_, &extension1_expectation_}, 119 const TestData test_data[] = {{&extension1_id_, &extension1_expectation_},
120 {&extension2_id_, &extension2_expectation_}, 120 {&extension2_id_, &extension2_expectation_},
121 {&extension3_id_, &extension3_expectation_}, 121 {&extension3_id_, &extension3_expectation_},
122 {&extension4_id_, &extension4_expectation_}}; 122 {&extension4_id_, &extension4_expectation_}};
123 for (size_t i = 0; i < arraysize(test_data); i++) { 123 for (size_t i = 0; i < arraysize(test_data); i++) {
(...skipping 24 matching lines...) Expand all
148 148
149 // Needed for |gallery_prefs_| to initialize correctly. 149 // Needed for |gallery_prefs_| to initialize correctly.
150 EnsureMediaDirectoriesExists ensure_media_directories_exists_; 150 EnsureMediaDirectoriesExists ensure_media_directories_exists_;
151 content::TestBrowserThread file_thread_; 151 content::TestBrowserThread file_thread_;
152 152
153 scoped_ptr<TestingProfile> profile_; 153 scoped_ptr<TestingProfile> profile_;
154 scoped_ptr<MediaGalleriesPreferences> gallery_prefs_; 154 scoped_ptr<MediaGalleriesPreferences> gallery_prefs_;
155 }; 155 };
156 156
157 TEST_F(MediaGalleriesPermissionsTest, MediaGalleries) {} 157 TEST_F(MediaGalleriesPermissionsTest, MediaGalleries) {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698