| 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 #include <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 explicit Event(int request_id) : request_id_(request_id) {} | 150 explicit Event(int request_id) : request_id_(request_id) {} |
| 151 virtual ~Event() {} | 151 virtual ~Event() {} |
| 152 int request_id() const { return request_id_; } | 152 int request_id() const { return request_id_; } |
| 153 | 153 |
| 154 private: | 154 private: |
| 155 int request_id_; | 155 int request_id_; |
| 156 }; | 156 }; |
| 157 | 157 |
| 158 class CreatedEvent : public Event { | 158 class CreatedEvent : public Event { |
| 159 public: | 159 public: |
| 160 CreatedEvent(int request_id, RequestManager::RequestType type) | 160 CreatedEvent(int request_id, RequestType type) |
| 161 : Event(request_id), type_(type) {} | 161 : Event(request_id), type_(type) {} |
| 162 virtual ~CreatedEvent() {} | 162 virtual ~CreatedEvent() {} |
| 163 | 163 |
| 164 RequestManager::RequestType type() const { return type_; } | 164 RequestType type() const { return type_; } |
| 165 | 165 |
| 166 private: | 166 private: |
| 167 RequestManager::RequestType type_; | 167 RequestType type_; |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 class FulfilledEvent : public Event { | 170 class FulfilledEvent : public Event { |
| 171 public: | 171 public: |
| 172 FulfilledEvent(int request_id, bool has_more) | 172 FulfilledEvent(int request_id, bool has_more) |
| 173 : Event(request_id), has_more_(has_more) {} | 173 : Event(request_id), has_more_(has_more) {} |
| 174 virtual ~FulfilledEvent() {} | 174 virtual ~FulfilledEvent() {} |
| 175 | 175 |
| 176 bool has_more() const { return has_more_; } | 176 bool has_more() const { return has_more_; } |
| 177 | 177 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 188 base::File::Error error() const { return error_; } | 188 base::File::Error error() const { return error_; } |
| 189 | 189 |
| 190 private: | 190 private: |
| 191 base::File::Error error_; | 191 base::File::Error error_; |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 RequestObserver() {} | 194 RequestObserver() {} |
| 195 virtual ~RequestObserver() {} | 195 virtual ~RequestObserver() {} |
| 196 | 196 |
| 197 // RequestManager::Observer overrides. | 197 // RequestManager::Observer overrides. |
| 198 virtual void OnRequestCreated(int request_id, | 198 virtual void OnRequestCreated(int request_id, RequestType type) OVERRIDE { |
| 199 RequestManager::RequestType type) OVERRIDE { | |
| 200 created_.push_back(CreatedEvent(request_id, type)); | 199 created_.push_back(CreatedEvent(request_id, type)); |
| 201 } | 200 } |
| 202 | 201 |
| 203 // RequestManager::Observer overrides. | 202 // RequestManager::Observer overrides. |
| 204 virtual void OnRequestDestroyed(int request_id) OVERRIDE { | 203 virtual void OnRequestDestroyed(int request_id) OVERRIDE { |
| 205 destroyed_.push_back(Event(request_id)); | 204 destroyed_.push_back(Event(request_id)); |
| 206 } | 205 } |
| 207 | 206 |
| 208 // RequestManager::Observer overrides. | 207 // RequestManager::Observer overrides. |
| 209 virtual void OnRequestExecuted(int request_id) OVERRIDE { | 208 virtual void OnRequestExecuted(int request_id) OVERRIDE { |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 ASSERT_EQ(1u, observer.timeouted().size()); | 665 ASSERT_EQ(1u, observer.timeouted().size()); |
| 667 EXPECT_EQ(request_id, observer.timeouted()[0].request_id()); | 666 EXPECT_EQ(request_id, observer.timeouted()[0].request_id()); |
| 668 ASSERT_EQ(1u, observer.destroyed().size()); | 667 ASSERT_EQ(1u, observer.destroyed().size()); |
| 669 EXPECT_EQ(request_id, observer.destroyed()[0].request_id()); | 668 EXPECT_EQ(request_id, observer.destroyed()[0].request_id()); |
| 670 | 669 |
| 671 request_manager_->RemoveObserver(&observer); | 670 request_manager_->RemoveObserver(&observer); |
| 672 } | 671 } |
| 673 | 672 |
| 674 } // namespace file_system_provider | 673 } // namespace file_system_provider |
| 675 } // namespace chromeos | 674 } // namespace chromeos |
| OLD | NEW |