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

Unified Diff: chrome/browser/extensions/api/image_writer_private/test_utils.h

Issue 61643015: Adds imageWriterPrivate support for Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup and now working on Windows with minimal changes. Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/image_writer_private/test_utils.h
diff --git a/chrome/browser/extensions/api/image_writer_private/test_utils.h b/chrome/browser/extensions/api/image_writer_private/test_utils.h
index b290e881ee87e86dd7096e3d1bfb981b5d9c5517..c61df2f2b6e9675c0474fefe14af90ab4eec2677 100644
--- a/chrome/browser/extensions/api/image_writer_private/test_utils.h
+++ b/chrome/browser/extensions/api/image_writer_private/test_utils.h
@@ -11,6 +11,7 @@
#include "base/run_loop.h"
#include "chrome/browser/extensions/api/image_writer_private/operation_manager.h"
#include "content/public/test/test_browser_thread_bundle.h"
+#include "content/public/test/test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -46,6 +47,20 @@ class MockOperationManager : public OperationManager {
const std::string& error_message));
};
+class QuittingMockManager : public MockOperationManager {
+ public:
+ explicit QuittingMockManager(const base::Closure& quit_closure);
+
+ virtual void OnComplete(const ExtensionId& extension_id);
+ virtual void OnError(const ExtensionId& extension_id,
+ image_writer_api::Stage stage,
+ int progress,
+ const std::string& error_message);
+
+ private:
+ base::Closure quit_closure_;
+};
+
// Base class for unit tests that manages creating image and device files.
class ImageWriterUnitTestBase : public testing::Test {
public:
@@ -57,22 +72,25 @@ class ImageWriterUnitTestBase : public testing::Test {
virtual void TearDown() OVERRIDE;
- // Compare the image and device files, returning true if they are the same,
- // false if different.
- bool CompareImageAndDevice();
+ // Verifies that the data in image_path was written to the file at
+ // device_path. This is different from base::ContentsEqual because the device
+ // may be larger than the image.
+ bool ImageWrittenToDevice(const base::FilePath& image_path,
+ const base::FilePath& device_path);
base::ScopedTempDir temp_dir_;
base::FilePath test_image_path_;
base::FilePath test_device_path_;
+ content::TestBrowserThreadBundle thread_bundle_;
+ content::InProcessUtilityThreadHelper utility_thread_helper_;
+
private:
// Fills |file| with |length| bytes of |pattern|, overwriting any existing
// data.
bool FillFile(const base::FilePath& file,
const int pattern,
const int length);
-
- content::TestBrowserThreadBundle thread_bundle_;
};
} // namespace image_writer

Powered by Google App Engine
This is Rietveld 408576698