OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef EXTENSIONS_BROWSER_TEST_IMAGE_LOADER_H_ |
| 6 #define EXTENSIONS_BROWSER_TEST_IMAGE_LOADER_H_ |
| 7 |
| 8 #include "base/run_loop.h" |
| 9 #include "ui/gfx/image/image.h" |
| 10 |
| 11 namespace extensions { |
| 12 |
| 13 class Extension; |
| 14 |
| 15 // Helper class for synchronously loading an extension image resource. |
| 16 class TestImageLoader { |
| 17 public: |
| 18 TestImageLoader(); |
| 19 ~TestImageLoader(); |
| 20 |
| 21 // Loads an image to be used in test from |extension|. |
| 22 // The image will be loaded from the relative path |image_path|. |
| 23 static SkBitmap LoadAndGetExtensionBitmap(const Extension* extension, |
| 24 const std::string& image_path, |
| 25 int size); |
| 26 |
| 27 private: |
| 28 void OnImageLoaded(const gfx::Image& image); |
| 29 |
| 30 SkBitmap LoadAndGetBitmap(const Extension* extension, |
| 31 const std::string& path, |
| 32 int size); |
| 33 |
| 34 gfx::Image image_; |
| 35 base::Closure loader_message_loop_quit_; |
| 36 bool waiting_; |
| 37 bool image_loaded_; |
| 38 |
| 39 DISALLOW_COPY_AND_ASSIGN(TestImageLoader); |
| 40 }; |
| 41 |
| 42 } // namespace extensions |
| 43 |
| 44 #endif // EXTENSIONS_BROWSER_TEST_IMAGE_LOADER_H_ |
OLD | NEW |