OLD | NEW |
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 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_TEST_UTIL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_TEST_UTIL_H_ |
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_TEST_UTIL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_TEST_UTIL_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/files/file.h" | 11 #include "base/files/file.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
14 | 14 |
15 namespace extensions { | 15 namespace extensions { |
16 struct Event; | 16 struct Event; |
17 } // namespace extensions | 17 } // namespace extensions |
18 | 18 |
19 namespace chromeos { | 19 namespace chromeos { |
20 namespace file_system_provider { | 20 namespace file_system_provider { |
21 namespace operations { | 21 namespace operations { |
22 namespace util { | 22 namespace util { |
23 | 23 |
24 // Fake event dispatcher implementation with extra logging capability. Acts as | 24 // Fake event dispatcher implementation with extra logging capability. Acts as |
25 // a providing extension end-point. | 25 // a providing extension end-point. |
26 class LoggingDispatchEventImpl { | 26 class LoggingDispatchEventImpl { |
27 public: | 27 public: |
28 explicit LoggingDispatchEventImpl(bool dispatch_reply); | 28 explicit LoggingDispatchEventImpl(bool dispatch_reply); |
29 virtual ~LoggingDispatchEventImpl(); | 29 virtual ~LoggingDispatchEventImpl(); |
30 | 30 |
31 // Handles sending an event to a providing extension. | 31 // Handles sending an event to a providing extension. |
32 bool OnDispatchEventImpl(scoped_ptr<extensions::Event> event); | 32 bool OnDispatchEventImpl(std::unique_ptr<extensions::Event> event); |
33 | 33 |
34 // Returns events sent to providing extensions. | 34 // Returns events sent to providing extensions. |
35 ScopedVector<extensions::Event>& events() { return events_; } | 35 ScopedVector<extensions::Event>& events() { return events_; } |
36 | 36 |
37 private: | 37 private: |
38 ScopedVector<extensions::Event> events_; | 38 ScopedVector<extensions::Event> events_; |
39 bool dispatch_reply_; | 39 bool dispatch_reply_; |
40 | 40 |
41 DISALLOW_COPY_AND_ASSIGN(LoggingDispatchEventImpl); | 41 DISALLOW_COPY_AND_ASSIGN(LoggingDispatchEventImpl); |
42 }; | 42 }; |
43 | 43 |
44 // Container for remembering operations' callback invocations. | 44 // Container for remembering operations' callback invocations. |
45 typedef std::vector<base::File::Error> StatusCallbackLog; | 45 typedef std::vector<base::File::Error> StatusCallbackLog; |
46 | 46 |
47 // Pushes a result of the StatusCallback invocation to a log vector. | 47 // Pushes a result of the StatusCallback invocation to a log vector. |
48 void LogStatusCallback(StatusCallbackLog* log, base::File::Error result); | 48 void LogStatusCallback(StatusCallbackLog* log, base::File::Error result); |
49 | 49 |
50 } // namespace util | 50 } // namespace util |
51 } // namespace operations | 51 } // namespace operations |
52 } // namespace file_system_provider | 52 } // namespace file_system_provider |
53 } // namespace chromeos | 53 } // namespace chromeos |
54 | 54 |
55 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_TEST_UTIL_H_ | 55 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_TEST_UTIL_H_ |
OLD | NEW |