OLD | NEW |
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 "chrome/browser/extensions/api/image_writer_private/operation_manager.h
" |
| 6 |
| 7 #include <memory> |
| 8 |
5 #include "base/command_line.h" | 9 #include "base/command_line.h" |
6 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/ptr_util.h" |
7 #include "build/build_config.h" | 11 #include "build/build_config.h" |
8 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" | 12 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" |
9 #include "chrome/browser/extensions/api/image_writer_private/operation_manager.h
" | |
10 #include "chrome/browser/extensions/api/image_writer_private/test_utils.h" | 13 #include "chrome/browser/extensions/api/image_writer_private/test_utils.h" |
11 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
12 #include "chrome/browser/extensions/extension_system_factory.h" | 15 #include "chrome/browser/extensions/extension_system_factory.h" |
13 #include "chrome/browser/extensions/test_extension_system.h" | 16 #include "chrome/browser/extensions/test_extension_system.h" |
14 #include "chrome/test/base/testing_profile.h" | 17 #include "chrome/test/base/testing_profile.h" |
15 #include "extensions/browser/event_router.h" | 18 #include "extensions/browser/event_router.h" |
16 #include "extensions/browser/event_router_factory.h" | 19 #include "extensions/browser/event_router_factory.h" |
17 | 20 |
18 #if defined(OS_CHROMEOS) | 21 #if defined(OS_CHROMEOS) |
19 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" | 22 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" |
20 #include "chrome/browser/chromeos/settings/cros_settings.h" | 23 #include "chrome/browser/chromeos/settings/cros_settings.h" |
21 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 24 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
22 #endif | 25 #endif |
23 | 26 |
24 namespace extensions { | 27 namespace extensions { |
25 namespace image_writer { | 28 namespace image_writer { |
26 | 29 |
27 // A fake for the EventRouter. If tests require monitoring of interaction with | 30 // A fake for the EventRouter. If tests require monitoring of interaction with |
28 // the event router put the logic here. | 31 // the event router put the logic here. |
29 class FakeEventRouter : public extensions::EventRouter { | 32 class FakeEventRouter : public extensions::EventRouter { |
30 public: | 33 public: |
31 explicit FakeEventRouter(Profile* profile) : EventRouter(profile, NULL) {} | 34 explicit FakeEventRouter(Profile* profile) : EventRouter(profile, NULL) {} |
32 | 35 |
33 void DispatchEventToExtension(const std::string& extension_id, | 36 void DispatchEventToExtension( |
34 scoped_ptr<extensions::Event> event) override { | 37 const std::string& extension_id, |
| 38 std::unique_ptr<extensions::Event> event) override { |
35 // Do nothing with the event as no tests currently care. | 39 // Do nothing with the event as no tests currently care. |
36 } | 40 } |
37 }; | 41 }; |
38 | 42 |
39 // FakeEventRouter factory function | 43 // FakeEventRouter factory function |
40 scoped_ptr<KeyedService> FakeEventRouterFactoryFunction( | 44 std::unique_ptr<KeyedService> FakeEventRouterFactoryFunction( |
41 content::BrowserContext* context) { | 45 content::BrowserContext* context) { |
42 return make_scoped_ptr(new FakeEventRouter(static_cast<Profile*>(context))); | 46 return base::WrapUnique(new FakeEventRouter(static_cast<Profile*>(context))); |
43 } | 47 } |
44 | 48 |
45 namespace { | 49 namespace { |
46 | 50 |
47 class ImageWriterOperationManagerTest : public ImageWriterUnitTestBase { | 51 class ImageWriterOperationManagerTest : public ImageWriterUnitTestBase { |
48 public: | 52 public: |
49 void StartCallback(bool success, const std::string& error) { | 53 void StartCallback(bool success, const std::string& error) { |
50 started_ = true; | 54 started_ = true; |
51 start_success_ = success; | 55 start_success_ = success; |
52 start_error_ = error; | 56 start_error_ = error; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 EXPECT_TRUE(cancelled_); | 140 EXPECT_TRUE(cancelled_); |
137 EXPECT_TRUE(cancel_success_); | 141 EXPECT_TRUE(cancel_success_); |
138 EXPECT_EQ("", cancel_error_); | 142 EXPECT_EQ("", cancel_error_); |
139 | 143 |
140 base::RunLoop().RunUntilIdle(); | 144 base::RunLoop().RunUntilIdle(); |
141 } | 145 } |
142 | 146 |
143 } // namespace | 147 } // namespace |
144 } // namespace image_writer | 148 } // namespace image_writer |
145 } // namespace extensions | 149 } // namespace extensions |
OLD | NEW |