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

Side by Side Diff: chrome/browser/extensions/api/image_writer_private/operation_unittest.cc

Issue 624153002: replace OVERRIDE and FINAL with override and final in chrome/browser/extensions/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/files/file_util.h" 5 #include "base/files/file_util.h"
6 #include "base/files/scoped_temp_dir.h" 6 #include "base/files/scoped_temp_dir.h"
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" 9 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h"
10 #include "chrome/browser/extensions/api/image_writer_private/operation.h" 10 #include "chrome/browser/extensions/api/image_writer_private/operation.h"
(...skipping 19 matching lines...) Expand all
30 30
31 // This class gives us a generic Operation with the ability to set or inspect 31 // This class gives us a generic Operation with the ability to set or inspect
32 // the current path to the image file. 32 // the current path to the image file.
33 class OperationForTest : public Operation { 33 class OperationForTest : public Operation {
34 public: 34 public:
35 OperationForTest(base::WeakPtr<OperationManager> manager_, 35 OperationForTest(base::WeakPtr<OperationManager> manager_,
36 const ExtensionId& extension_id, 36 const ExtensionId& extension_id,
37 const std::string& device_path) 37 const std::string& device_path)
38 : Operation(manager_, extension_id, device_path) {} 38 : Operation(manager_, extension_id, device_path) {}
39 39
40 virtual void StartImpl() OVERRIDE {} 40 virtual void StartImpl() override {}
41 41
42 // Expose internal stages for testing. 42 // Expose internal stages for testing.
43 void Unzip(const base::Closure& continuation) { 43 void Unzip(const base::Closure& continuation) {
44 Operation::Unzip(continuation); 44 Operation::Unzip(continuation);
45 } 45 }
46 46
47 void Write(const base::Closure& continuation) { 47 void Write(const base::Closure& continuation) {
48 Operation::Write(continuation); 48 Operation::Write(continuation);
49 } 49 }
50 50
51 void VerifyWrite(const base::Closure& continuation) { 51 void VerifyWrite(const base::Closure& continuation) {
52 Operation::VerifyWrite(continuation); 52 Operation::VerifyWrite(continuation);
53 } 53 }
54 54
55 // Helpers to set-up state for intermediate stages. 55 // Helpers to set-up state for intermediate stages.
56 void SetImagePath(const base::FilePath image_path) { 56 void SetImagePath(const base::FilePath image_path) {
57 image_path_ = image_path; 57 image_path_ = image_path;
58 } 58 }
59 59
60 base::FilePath GetImagePath() { return image_path_; } 60 base::FilePath GetImagePath() { return image_path_; }
61 61
62 private: 62 private:
63 virtual ~OperationForTest() {}; 63 virtual ~OperationForTest() {};
64 }; 64 };
65 65
66 class ImageWriterOperationTest : public ImageWriterUnitTestBase { 66 class ImageWriterOperationTest : public ImageWriterUnitTestBase {
67 protected: 67 protected:
68 ImageWriterOperationTest() 68 ImageWriterOperationTest()
69 : profile_(new TestingProfile), manager_(profile_.get()) {} 69 : profile_(new TestingProfile), manager_(profile_.get()) {}
70 virtual void SetUp() OVERRIDE { 70 virtual void SetUp() override {
71 ImageWriterUnitTestBase::SetUp(); 71 ImageWriterUnitTestBase::SetUp();
72 72
73 // Create the zip file. 73 // Create the zip file.
74 base::FilePath image_dir = test_utils_.GetTempDir().AppendASCII("zip"); 74 base::FilePath image_dir = test_utils_.GetTempDir().AppendASCII("zip");
75 ASSERT_TRUE(base::CreateDirectory(image_dir)); 75 ASSERT_TRUE(base::CreateDirectory(image_dir));
76 ASSERT_TRUE(base::CreateTemporaryFileInDir(image_dir, &image_path_)); 76 ASSERT_TRUE(base::CreateTemporaryFileInDir(image_dir, &image_path_));
77 77
78 test_utils_.FillFile(image_path_, kImagePattern, kTestFileSize); 78 test_utils_.FillFile(image_path_, kImagePattern, kTestFileSize);
79 79
80 zip_file_ = test_utils_.GetTempDir().AppendASCII("test_image.zip"); 80 zip_file_ = test_utils_.GetTempDir().AppendASCII("test_image.zip");
81 ASSERT_TRUE(zip::Zip(image_dir, zip_file_, true)); 81 ASSERT_TRUE(zip::Zip(image_dir, zip_file_, true));
82 82
83 // Operation setup. 83 // Operation setup.
84 operation_ = 84 operation_ =
85 new OperationForTest(manager_.AsWeakPtr(), 85 new OperationForTest(manager_.AsWeakPtr(),
86 kDummyExtensionId, 86 kDummyExtensionId,
87 test_utils_.GetDevicePath().AsUTF8Unsafe()); 87 test_utils_.GetDevicePath().AsUTF8Unsafe());
88 operation_->SetImagePath(test_utils_.GetImagePath()); 88 operation_->SetImagePath(test_utils_.GetImagePath());
89 } 89 }
90 90
91 virtual void TearDown() OVERRIDE { 91 virtual void TearDown() override {
92 // Ensure all callbacks have been destroyed and cleanup occurs. 92 // Ensure all callbacks have been destroyed and cleanup occurs.
93 operation_->Cancel(); 93 operation_->Cancel();
94 94
95 ImageWriterUnitTestBase::TearDown(); 95 ImageWriterUnitTestBase::TearDown();
96 } 96 }
97 97
98 base::FilePath image_path_; 98 base::FilePath image_path_;
99 base::FilePath zip_file_; 99 base::FilePath zip_file_;
100 100
101 scoped_ptr<TestingProfile> profile_; 101 scoped_ptr<TestingProfile> profile_;
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 #endif 260 #endif
261 261
262 // Tests that on creation the operation_ has the expected state. 262 // Tests that on creation the operation_ has the expected state.
263 TEST_F(ImageWriterOperationTest, Creation) { 263 TEST_F(ImageWriterOperationTest, Creation) {
264 EXPECT_EQ(0, operation_->GetProgress()); 264 EXPECT_EQ(0, operation_->GetProgress());
265 EXPECT_EQ(image_writer_api::STAGE_UNKNOWN, operation_->GetStage()); 265 EXPECT_EQ(image_writer_api::STAGE_UNKNOWN, operation_->GetStage());
266 } 266 }
267 267
268 } // namespace image_writer 268 } // namespace image_writer
269 } // namespace extensions 269 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698