OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/google_apis/test_util.h" | 5 #include "chrome/browser/google_apis/test_util.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/json/json_file_value_serializer.h" | 8 #include "base/json/json_file_value_serializer.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/pending_task.h" |
12 #include "base/string_util.h" | 13 #include "base/string_util.h" |
13 #include "base/stringprintf.h" | 14 #include "base/stringprintf.h" |
14 #include "base/threading/sequenced_worker_pool.h" | 15 #include "base/threading/sequenced_worker_pool.h" |
15 #include "chrome/browser/google_apis/drive_api_parser.h" | 16 #include "chrome/browser/google_apis/drive_api_parser.h" |
16 #include "chrome/browser/google_apis/gdata_wapi_parser.h" | 17 #include "chrome/browser/google_apis/gdata_wapi_parser.h" |
17 #include "chrome/browser/google_apis/test_server/http_response.h" | 18 #include "chrome/browser/google_apis/test_server/http_response.h" |
18 #include "chrome/browser/google_apis/test_server/http_server.h" | 19 #include "chrome/browser/google_apis/test_server/http_server.h" |
19 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
20 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
21 | 22 |
22 namespace google_apis { | 23 namespace google_apis { |
23 namespace test_util { | 24 namespace test_util { |
24 | 25 |
25 // This class is used to monitor if any task is posted to a message loop. | 26 // This class is used to monitor if any task is posted to a message loop. |
26 class TaskObserver : public MessageLoop::TaskObserver { | 27 class TaskObserver : public MessageLoop::TaskObserver { |
27 public: | 28 public: |
28 TaskObserver() : posted_(false) {} | 29 TaskObserver() : posted_(false) {} |
29 virtual ~TaskObserver() {} | 30 virtual ~TaskObserver() {} |
30 | 31 |
31 // MessageLoop::TaskObserver overrides. | 32 // MessageLoop::TaskObserver overrides. |
32 virtual void WillProcessTask(base::TimeTicks time_posted) {} | 33 virtual void WillProcessTask(const base::PendingTask& pending_task) OVERRIDE { |
33 virtual void DidProcessTask(base::TimeTicks time_posted) { | 34 } |
| 35 virtual void DidProcessTask(const base::PendingTask& pending_task) OVERRIDE { |
34 posted_ = true; | 36 posted_ = true; |
35 } | 37 } |
36 | 38 |
37 // Returns true if any task was posted. | 39 // Returns true if any task was posted. |
38 bool posted() const { return posted_; } | 40 bool posted() const { return posted_; } |
39 | 41 |
40 private: | 42 private: |
41 bool posted_; | 43 bool posted_; |
42 DISALLOW_COPY_AND_ASSIGN(TaskObserver); | 44 DISALLOW_COPY_AND_ASSIGN(TaskObserver); |
43 }; | 45 }; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 LOG(ERROR) | 204 LOG(ERROR) |
203 << "The value of json_data is different from the file's content."; | 205 << "The value of json_data is different from the file's content."; |
204 return false; | 206 return false; |
205 } | 207 } |
206 | 208 |
207 return true; | 209 return true; |
208 } | 210 } |
209 | 211 |
210 } // namespace test_util | 212 } // namespace test_util |
211 } // namespace google_apis | 213 } // namespace google_apis |
OLD | NEW |