| 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/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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 pending_loop_ = loop; | 141 pending_loop_ = loop; |
| 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 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 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 Loading... |
| 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 |
| OLD | NEW |