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

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: Fixes up DBusThreadManager initialization. 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 23 matching lines...) Expand all
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
66 TEST_F(ImageWriterOperationManagerTest, WriteFromFile) { 68 TEST_F(ImageWriterOperationManagerTest, WriteFromFile) {
67 OperationManager manager(&test_profile_); 69 OperationManager manager(&test_profile_);
68 70
69 manager.StartWriteFromFile( 71 manager.StartWriteFromFile(
70 kDummyExtensionId, 72 kDummyExtensionId,
71 test_image_, 73 test_image_path_,
72 test_device_.AsUTF8Unsafe(), 74 test_device_path_.AsUTF8Unsafe(),
73 base::Bind(&ImageWriterOperationManagerTest::StartCallback, 75 base::Bind(&ImageWriterOperationManagerTest::StartCallback,
74 base::Unretained(this))); 76 base::Unretained(this)));
75 77
76 EXPECT_TRUE(started_); 78 EXPECT_TRUE(started_);
77 EXPECT_TRUE(start_success_); 79 EXPECT_TRUE(start_success_);
78 EXPECT_EQ("", start_error_); 80 EXPECT_EQ("", start_error_);
79 } 81 }
80 82
81 } // namespace image_writer 83 TEST_F(ImageWriterOperationManagerTest, DestroyPartitions) {
82 } // namespace extensions 84 OperationManager manager(&test_profile_);
85
86 manager.DestroyPartitions(
87 kDummyExtensionId,
88 test_device_path_.AsUTF8Unsafe(),
89 base::Bind(&ImageWriterOperationManagerTest::StartCallback,
90 base::Unretained(this)));
91
92 EXPECT_TRUE(started_);
93 EXPECT_TRUE(start_success_);
94 EXPECT_EQ("", start_error_);
95 }
96
97 } // namespace
98 } // namespace image_writer
99 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698