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

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

Issue 109793006: Adds ImageWriterPrivate.destroyPartitions operation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup Created 7 years 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/command_line.h" 5 #include "base/command_line.h"
6 #include "chrome/browser/chromeos/login/user_manager.h" 6 #include "chrome/browser/chromeos/login/user_manager.h"
7 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" 7 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h"
8 #include "chrome/browser/extensions/api/image_writer_private/operation_manager.h "
8 #include "chrome/browser/extensions/api/image_writer_private/test_utils.h" 9 #include "chrome/browser/extensions/api/image_writer_private/test_utils.h"
9 #include "chrome/browser/extensions/api/image_writer_private/write_from_file_ope ration.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
11 #include "chrome/browser/extensions/test_extension_system.h" 11 #include "chrome/browser/extensions/test_extension_system.h"
12 #include "chrome/test/base/testing_profile.h" 12 #include "chrome/test/base/testing_profile.h"
13 13
14 #if defined(OS_CHROMEOS) 14 #if defined(OS_CHROMEOS)
15 #include "chrome/browser/chromeos/login/user_manager.h" 15 #include "chrome/browser/chromeos/login/user_manager.h"
16 #include "chrome/browser/chromeos/settings/cros_settings.h" 16 #include "chrome/browser/chromeos/settings/cros_settings.h"
17 #include "chrome/browser/chromeos/settings/device_settings_service.h" 17 #include "chrome/browser/chromeos/settings/device_settings_service.h"
18 #endif 18 #endif
19 19
20 namespace extensions { 20 namespace extensions {
21 namespace image_writer { 21 namespace image_writer {
22 22
23 using testing::_; 23 using testing::_;
24 using testing::Lt; 24 using testing::Lt;
25 using testing::AnyNumber; 25 using testing::AnyNumber;
26 using testing::AtLeast; 26 using testing::AtLeast;
27 27
28 namespace {
29
28 class ImageWriterOperationManagerTest 30 class ImageWriterOperationManagerTest
29 : public ImageWriterUnitTestBase { 31 : public ImageWriterUnitTestBase {
30 public: 32 public:
31 void StartCallback(bool success, const std::string& error) { 33 void StartCallback(bool success, const std::string& error) {
32 started_ = true; 34 started_ = true;
33 start_success_ = success; 35 start_success_ = success;
34 start_error_ = error; 36 start_error_ = error;
35 } 37 }
36 38
37 protected: 39 protected:
(...skipping 18 matching lines...) Expand all
56 TestingProfile test_profile_; 58 TestingProfile test_profile_;
57 ExtensionService* extension_service_; 59 ExtensionService* extension_service_;
58 60
59 #if defined OS_CHROMEOS 61 #if defined OS_CHROMEOS
60 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; 62 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_;
61 chromeos::ScopedTestCrosSettings test_cros_settings_; 63 chromeos::ScopedTestCrosSettings test_cros_settings_;
62 chromeos::ScopedTestUserManager test_user_manager_; 64 chromeos::ScopedTestUserManager test_user_manager_;
63 #endif 65 #endif
64 }; 66 };
65 67
68 } // namespace
tbarzic 2013/12/14 01:01:04 the tests should be in the namespace too
Drew Haven 2013/12/16 20:15:33 Done.
69
66 TEST_F(ImageWriterOperationManagerTest, WriteFromFile) { 70 TEST_F(ImageWriterOperationManagerTest, WriteFromFile) {
67 OperationManager manager(&test_profile_); 71 OperationManager manager(&test_profile_);
68 72
69 manager.StartWriteFromFile( 73 manager.StartWriteFromFile(
70 kDummyExtensionId, 74 kDummyExtensionId,
71 test_image_, 75 test_image_path_,
72 test_device_.AsUTF8Unsafe(), 76 test_device_path_.AsUTF8Unsafe(),
73 base::Bind(&ImageWriterOperationManagerTest::StartCallback, 77 base::Bind(&ImageWriterOperationManagerTest::StartCallback,
74 base::Unretained(this))); 78 base::Unretained(this)));
75 79
76 EXPECT_TRUE(started_); 80 EXPECT_TRUE(started_);
77 EXPECT_TRUE(start_success_); 81 EXPECT_TRUE(start_success_);
78 EXPECT_EQ("", start_error_); 82 EXPECT_EQ("", start_error_);
79 } 83 }
80 84
85 TEST_F(ImageWriterOperationManagerTest, DestroyPartitions) {
86 OperationManager manager(&test_profile_);
87
88 manager.DestroyPartitions(
89 kDummyExtensionId,
90 test_device_path_.AsUTF8Unsafe(),
91 base::Bind(&ImageWriterOperationManagerTest::StartCallback,
92 base::Unretained(this)));
93
94 EXPECT_TRUE(started_);
95 EXPECT_TRUE(start_success_);
96 EXPECT_EQ("", start_error_);
97 }
98
81 } // namespace image_writer 99 } // namespace image_writer
82 } // namespace extensions 100 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698