Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / chromeos / file_system_provider / operations / test_util.h
blobdf05e0ed0e83f21f0a856920c6672ac1bf583e87
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_TEST_UTIL_H_
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_TEST_UTIL_H_
8 #include <vector>
10 #include "base/files/file.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/scoped_vector.h"
14 namespace extensions {
15 struct Event;
16 } // namespace extensions
18 namespace chromeos {
19 namespace file_system_provider {
20 namespace operations {
21 namespace util {
23 // Fake event dispatcher implementation with extra logging capability. Acts as
24 // a providing extension end-point.
25 class LoggingDispatchEventImpl {
26 public:
27 explicit LoggingDispatchEventImpl(bool dispatch_reply);
28 virtual ~LoggingDispatchEventImpl();
30 // Handles sending an event to a providing extension.
31 bool OnDispatchEventImpl(scoped_ptr<extensions::Event> event);
33 // Returns events sent to providing extensions.
34 ScopedVector<extensions::Event>& events() { return events_; }
36 private:
37 ScopedVector<extensions::Event> events_;
38 bool dispatch_reply_;
40 DISALLOW_COPY_AND_ASSIGN(LoggingDispatchEventImpl);
43 // Container for remembering operations' callback invocations.
44 typedef std::vector<base::File::Error> StatusCallbackLog;
46 // Pushes a result of the StatusCallback invocation to a log vector.
47 void LogStatusCallback(StatusCallbackLog* log, base::File::Error result);
49 } // namespace util
50 } // namespace operations
51 } // namespace file_system_provider
52 } // namespace chromeos
54 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_TEST_UTIL_H_