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

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: Fixes test cleanup ordering for Chrome OS. 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 a19a48c6446e151cd809652a178b64b4525510e3..9542bbb3b6b30823503ed67adf8077997431dee2 100644
--- a/chrome/browser/extensions/api/image_writer_private/test_utils.h
+++ b/chrome/browser/extensions/api/image_writer_private/test_utils.h
@@ -9,8 +9,10 @@
#include "base/files/scoped_temp_dir.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
+#include "chrome/browser/extensions/api/image_writer_private/image_writer_utility_client.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"
@@ -47,17 +49,57 @@ class MockOperationManager : public OperationManager {
const std::string& error_message));
};
+class FakeImageWriterClient : public ImageWriterUtilityClient {
+ public:
+ FakeImageWriterClient();
+
+ virtual void Write(const ProgressCallback& progress_callback,
+ const SuccessCallback& success_callback,
+ const ErrorCallback& error_callback,
+ const base::FilePath& source,
+ const base::FilePath& target) OVERRIDE;
+
+ virtual void Verify(const ProgressCallback& progress_callback,
+ const SuccessCallback& success_callback,
+ const ErrorCallback& error_callback,
+ const base::FilePath& source,
+ const base::FilePath& target) OVERRIDE;
+
+ virtual void Cancel(const CancelCallback& cancel_callback) OVERRIDE;
+
+ virtual void Shutdown() OVERRIDE;
+
+ void Progress(int64 progress);
+ void Success();
+ void Error(const std::string& message);
+ void Cancel();
+ static scoped_refptr<FakeImageWriterClient> Create();
+
+ private:
+ virtual ~FakeImageWriterClient();
+
+ ProgressCallback progress_callback_;
+ SuccessCallback success_callback_;
+ ErrorCallback error_callback_;
+ CancelCallback cancel_callback_;
+};
+
// Base class for unit tests that manages creating image and device files.
class ImageWriterUnitTestBase : public testing::Test {
- public:
+ protected:
ImageWriterUnitTestBase();
virtual ~ImageWriterUnitTestBase();
- protected:
virtual void SetUp() OVERRIDE;
virtual void TearDown() OVERRIDE;
+ // 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);
+
// Fills |file| with |length| bytes of |pattern|, overwriting any existing
// data.
bool FillFile(const base::FilePath& file,

Powered by Google App Engine
This is Rietveld 408576698