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 #ifndef CHROME_BROWSER_HISTORY_ANDROID_SQLITE_CURSOR_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_ANDROID_SQLITE_CURSOR_H_ |
6 #define CHROME_BROWSER_HISTORY_ANDROID_SQLITE_CURSOR_H_ | 6 #define CHROME_BROWSER_HISTORY_ANDROID_SQLITE_CURSOR_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 }; | 38 }; |
39 | 39 |
40 // This class is intended to be used only in unit tests. | 40 // This class is intended to be used only in unit tests. |
41 // | 41 // |
42 // There are 2 threads in unit test, one is the UI thread, another is the DB | 42 // There are 2 threads in unit test, one is the UI thread, another is the DB |
43 // thread, after the task posted into UI thread, the MessageLoop needs to run | 43 // thread, after the task posted into UI thread, the MessageLoop needs to run |
44 // to execute the task. The OnPostMoveToTask() and the OnPostGetFaviconTask() | 44 // to execute the task. The OnPostMoveToTask() and the OnPostGetFaviconTask() |
45 // give unit tests a chance to run the message loop before event_.Wait is | 45 // give unit tests a chance to run the message loop before event_.Wait is |
46 // invoked, The OnGetMoveToResult() and OnGetFaviconResult() is used to notify | 46 // invoked, The OnGetMoveToResult() and OnGetFaviconResult() is used to notify |
47 // the test observer in the UI thread when the task's result comes back, it | 47 // the test observer in the UI thread when the task's result comes back, it |
48 // calls MessageLoop::Quit() to exit the loop, then the event.Wait() is | 48 // calls MessageLoop::QuitWhenIdle() to exit the loop, then the event.Wait() |
49 // called. Basically, Two threads are used to simulate 3 threads' behavior | 49 // is called. Basically, Two threads are used to simulate 3 threads' behavior |
50 // here. | 50 // here. |
51 // The whole observer design is only for test purpose and should only be used | 51 // The whole observer design is only for test purpose and should only be used |
52 // in unit test. | 52 // in unit test. |
53 class TestObserver { | 53 class TestObserver { |
54 public: | 54 public: |
55 TestObserver(); | 55 TestObserver(); |
56 | 56 |
57 // Notify the MoveTo task has been posted to UI thread. | 57 // Notify the MoveTo task has been posted to UI thread. |
58 virtual void OnPostMoveToTask() = 0; | 58 virtual void OnPostMoveToTask() = 0; |
59 // Notify the MoveTo result has been gotten in UI thread. | 59 // Notify the MoveTo result has been gotten in UI thread. |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 // The favicon image. | 183 // The favicon image. |
184 favicon_base::FaviconRawBitmapResult favicon_bitmap_result_; | 184 favicon_base::FaviconRawBitmapResult favicon_bitmap_result_; |
185 | 185 |
186 TestObserver* test_observer_; | 186 TestObserver* test_observer_; |
187 | 187 |
188 DISALLOW_COPY_AND_ASSIGN(SQLiteCursor); | 188 DISALLOW_COPY_AND_ASSIGN(SQLiteCursor); |
189 }; | 189 }; |
190 | 190 |
191 #endif // CHROME_BROWSER_HISTORY_ANDROID_SQLITE_CURSOR_H_ | 191 #endif // CHROME_BROWSER_HISTORY_ANDROID_SQLITE_CURSOR_H_ |
OLD | NEW |