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

Side by Side Diff: chrome/utility/image_writer/image_writer_unittest.cc

Issue 1548153002: Switch to standard integer types in chrome/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 <stdint.h>
6 #include <string.h>
7
5 #include <string> 8 #include <string>
6 9
7 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
8 #include "base/files/scoped_temp_dir.h" 11 #include "base/files/scoped_temp_dir.h"
9 #include "base/run_loop.h" 12 #include "base/run_loop.h"
10 #include "chrome/utility/image_writer/error_messages.h" 13 #include "chrome/utility/image_writer/error_messages.h"
11 #include "chrome/utility/image_writer/image_writer.h" 14 #include "chrome/utility/image_writer/image_writer.h"
12 #include "chrome/utility/image_writer/image_writer_handler.h" 15 #include "chrome/utility/image_writer/image_writer_handler.h"
13 #include "testing/gmock/include/gmock/gmock.h" 16 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
15 18
16 namespace image_writer { 19 namespace image_writer {
17 20
18 using testing::_; 21 using testing::_;
19 using testing::AnyNumber; 22 using testing::AnyNumber;
20 using testing::AtLeast; 23 using testing::AtLeast;
21 using testing::Lt; 24 using testing::Lt;
22 25
23 namespace { 26 namespace {
24 27
25 const int64 kTestFileSize = 1 << 15; // 32 kB 28 const int64_t kTestFileSize = 1 << 15; // 32 kB
26 const int kTestPattern = 0x55555555; 29 const int kTestPattern = 0x55555555;
27 30
28 class ImageWriterUtilityTest : public testing::Test { 31 class ImageWriterUtilityTest : public testing::Test {
29 protected: 32 protected:
30 void SetUp() override { 33 void SetUp() override {
31 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 34 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
32 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &image_path_)); 35 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &image_path_));
33 ASSERT_TRUE( 36 ASSERT_TRUE(
34 base::CreateTemporaryFileInDir(temp_dir_.path(), &device_path_)); 37 base::CreateTemporaryFileInDir(temp_dir_.path(), &device_path_));
35 } 38 }
(...skipping 12 matching lines...) Expand all
48 base::FilePath image_path_; 51 base::FilePath image_path_;
49 base::FilePath device_path_; 52 base::FilePath device_path_;
50 53
51 private: 54 private:
52 base::MessageLoop message_loop_; 55 base::MessageLoop message_loop_;
53 base::ScopedTempDir temp_dir_; 56 base::ScopedTempDir temp_dir_;
54 }; 57 };
55 58
56 class MockHandler : public ImageWriterHandler { 59 class MockHandler : public ImageWriterHandler {
57 public: 60 public:
58 MOCK_METHOD1(SendProgress, void(int64)); 61 MOCK_METHOD1(SendProgress, void(int64_t));
59 MOCK_METHOD1(SendFailed, void(const std::string& message)); 62 MOCK_METHOD1(SendFailed, void(const std::string& message));
60 MOCK_METHOD0(SendSucceeded, void()); 63 MOCK_METHOD0(SendSucceeded, void());
61 MOCK_METHOD1(OnMessageReceived, bool(const IPC::Message& message)); 64 MOCK_METHOD1(OnMessageReceived, bool(const IPC::Message& message));
62 }; 65 };
63 66
64 // This Mock has the additional feature that it will start verification when 67 // This Mock has the additional feature that it will start verification when
65 // the write completes. 68 // the write completes.
66 class VerifyingHandler : public MockHandler { 69 class VerifyingHandler : public MockHandler {
67 public: 70 public:
68 VerifyingHandler() : image_writer_(NULL), verified_(false) {} 71 VerifyingHandler() : image_writer_(NULL), verified_(false) {}
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 EXPECT_CALL(mock_handler, SendFailed(_)).Times(0); 224 EXPECT_CALL(mock_handler, SendFailed(_)).Times(0);
222 225
223 FillDefault(image_path_); 226 FillDefault(image_path_);
224 227
225 image_writer.Write(); 228 image_writer.Write();
226 229
227 base::RunLoop().RunUntilIdle(); 230 base::RunLoop().RunUntilIdle();
228 } 231 }
229 232
230 } // namespace image_writer 233 } // namespace image_writer
OLDNEW
« no previous file with comments | « chrome/utility/image_writer/image_writer_mac.cc ('k') | chrome/utility/image_writer/image_writer_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698