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

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

Issue 624173002: replace OVERRIDE and FINAL with override and final in chrome/browser/[j-q]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master 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 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/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 GalleryWatchManagerTest() 54 GalleryWatchManagerTest()
55 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), 55 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP),
56 profile_(new TestingProfile()), 56 profile_(new TestingProfile()),
57 gallery_prefs_(NULL), 57 gallery_prefs_(NULL),
58 expect_gallery_changed_(false), 58 expect_gallery_changed_(false),
59 expect_gallery_watch_dropped_(false), 59 expect_gallery_watch_dropped_(false),
60 pending_loop_(NULL) {} 60 pending_loop_(NULL) {}
61 61
62 virtual ~GalleryWatchManagerTest() {} 62 virtual ~GalleryWatchManagerTest() {}
63 63
64 virtual void SetUp() OVERRIDE { 64 virtual void SetUp() override {
65 ASSERT_TRUE(storage_monitor::TestStorageMonitor::CreateAndInstall()); 65 ASSERT_TRUE(storage_monitor::TestStorageMonitor::CreateAndInstall());
66 66
67 extensions::TestExtensionSystem* extension_system( 67 extensions::TestExtensionSystem* extension_system(
68 static_cast<extensions::TestExtensionSystem*>( 68 static_cast<extensions::TestExtensionSystem*>(
69 extensions::ExtensionSystem::Get(profile_.get()))); 69 extensions::ExtensionSystem::Get(profile_.get())));
70 extension_system->CreateExtensionService( 70 extension_system->CreateExtensionService(
71 base::CommandLine::ForCurrentProcess(), base::FilePath(), false); 71 base::CommandLine::ForCurrentProcess(), base::FilePath(), false);
72 72
73 gallery_prefs_ = 73 gallery_prefs_ =
74 MediaGalleriesPreferencesFactory::GetForProfile(profile_.get()); 74 MediaGalleriesPreferencesFactory::GetForProfile(profile_.get());
75 base::RunLoop loop; 75 base::RunLoop loop;
76 gallery_prefs_->EnsureInitialized(loop.QuitClosure()); 76 gallery_prefs_->EnsureInitialized(loop.QuitClosure());
77 loop.Run(); 77 loop.Run();
78 78
79 std::vector<std::string> read_permissions; 79 std::vector<std::string> read_permissions;
80 read_permissions.push_back( 80 read_permissions.push_back(
81 extensions::MediaGalleriesPermission::kReadPermission); 81 extensions::MediaGalleriesPermission::kReadPermission);
82 extension_ = AddMediaGalleriesApp("read", read_permissions, profile_.get()); 82 extension_ = AddMediaGalleriesApp("read", read_permissions, profile_.get());
83 83
84 manager_.reset(new GalleryWatchManager); 84 manager_.reset(new GalleryWatchManager);
85 manager_->AddObserver(profile_.get(), this); 85 manager_->AddObserver(profile_.get(), this);
86 } 86 }
87 87
88 virtual void TearDown() OVERRIDE { 88 virtual void TearDown() override {
89 manager_->RemoveObserver(profile_.get()); 89 manager_->RemoveObserver(profile_.get());
90 manager_.reset(); 90 manager_.reset();
91 storage_monitor::TestStorageMonitor::Destroy(); 91 storage_monitor::TestStorageMonitor::Destroy();
92 } 92 }
93 93
94 protected: 94 protected:
95 // Create the specified path, and add it to preferences as a gallery. 95 // Create the specified path, and add it to preferences as a gallery.
96 MediaGalleryPrefId AddGallery(const base::FilePath& path) { 96 MediaGalleryPrefId AddGallery(const base::FilePath& path) {
97 MediaGalleryPrefInfo gallery_info; 97 MediaGalleryPrefInfo gallery_info;
98 EXPECT_FALSE(gallery_prefs_->LookUpGalleryByPath(path, &gallery_info)); 98 EXPECT_FALSE(gallery_prefs_->LookUpGalleryByPath(path, &gallery_info));
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 142 }
143 143
144 void ExpectGalleryWatchDropped(base::RunLoop* loop) { 144 void ExpectGalleryWatchDropped(base::RunLoop* loop) {
145 expect_gallery_watch_dropped_ = true; 145 expect_gallery_watch_dropped_ = true;
146 pending_loop_ = loop; 146 pending_loop_ = loop;
147 } 147 }
148 148
149 private: 149 private:
150 // GalleryWatchManagerObserver implementation. 150 // GalleryWatchManagerObserver implementation.
151 virtual void OnGalleryChanged(const std::string& extension_id, 151 virtual void OnGalleryChanged(const std::string& extension_id,
152 MediaGalleryPrefId gallery_id) OVERRIDE { 152 MediaGalleryPrefId gallery_id) override {
153 EXPECT_TRUE(expect_gallery_changed_); 153 EXPECT_TRUE(expect_gallery_changed_);
154 pending_loop_->Quit(); 154 pending_loop_->Quit();
155 } 155 }
156 156
157 virtual void OnGalleryWatchDropped(const std::string& extension_id, 157 virtual void OnGalleryWatchDropped(const std::string& extension_id,
158 MediaGalleryPrefId gallery_id) OVERRIDE { 158 MediaGalleryPrefId gallery_id) override {
159 EXPECT_TRUE(expect_gallery_watch_dropped_); 159 EXPECT_TRUE(expect_gallery_watch_dropped_);
160 pending_loop_->Quit(); 160 pending_loop_->Quit();
161 } 161 }
162 162
163 scoped_ptr<GalleryWatchManager> manager_; 163 scoped_ptr<GalleryWatchManager> manager_;
164 164
165 // Needed for extension service & friends to work. 165 // Needed for extension service & friends to work.
166 content::TestBrowserThreadBundle thread_bundle_; 166 content::TestBrowserThreadBundle thread_bundle_;
167 167
168 scoped_refptr<extensions::Extension> extension_; 168 scoped_refptr<extensions::Extension> extension_;
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 AddAndConfirmWatch(id); 322 AddAndConfirmWatch(id);
323 323
324 base::RunLoop success_loop; 324 base::RunLoop success_loop;
325 ExpectGalleryChanged(&success_loop); 325 ExpectGalleryChanged(&success_loop);
326 ASSERT_EQ( 326 ASSERT_EQ(
327 4, base::WriteFile(temp_dir.path().AppendASCII("fake file"), "blah", 4)); 327 4, base::WriteFile(temp_dir.path().AppendASCII("fake file"), "blah", 4));
328 success_loop.Run(); 328 success_loop.Run();
329 } 329 }
330 330
331 } // namespace component_updater 331 } // namespace component_updater
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698