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/history/android/sqlite_cursor.h" | 5 #include "chrome/browser/history/android/sqlite_cursor.h" |
6 | 6 |
7 #include <jni.h> | 7 #include <jni.h> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 base::MessageLoop::current()->Quit(); | 98 base::MessageLoop::current()->Quit(); |
99 } | 99 } |
100 | 100 |
101 protected: | 101 protected: |
102 TestingProfileManager profile_manager_; | 102 TestingProfileManager profile_manager_; |
103 base::MessageLoop message_loop_; | 103 base::MessageLoop message_loop_; |
104 content::TestBrowserThread ui_thread_; | 104 content::TestBrowserThread ui_thread_; |
105 content::TestBrowserThread file_thread_; | 105 content::TestBrowserThread file_thread_; |
106 scoped_ptr<AndroidHistoryProviderService> service_; | 106 scoped_ptr<AndroidHistoryProviderService> service_; |
107 base::CancelableTaskTracker cancelable_tracker_; | 107 base::CancelableTaskTracker cancelable_tracker_; |
108 CancelableRequestConsumer cancelable_consumer_; | |
109 TestingProfile* testing_profile_; | 108 TestingProfile* testing_profile_; |
110 HistoryService* hs_; | 109 HistoryService* hs_; |
111 | 110 |
112 | 111 |
113 private: | 112 private: |
114 DISALLOW_COPY_AND_ASSIGN(SQLiteCursorTest); | 113 DISALLOW_COPY_AND_ASSIGN(SQLiteCursorTest); |
115 }; | 114 }; |
116 | 115 |
117 class CallbackHelper : public base::RefCountedThreadSafe<CallbackHelper> { | 116 class CallbackHelper : public base::RefCountedThreadSafe<CallbackHelper> { |
118 public: | 117 public: |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 cursor->GetBlob(env, NULL, 3); | 223 cursor->GetBlob(env, NULL, 3); |
225 std::vector<uint8> out; | 224 std::vector<uint8> out; |
226 base::android::JavaByteArrayToByteVector(env, data.obj(), &out); | 225 base::android::JavaByteArrayToByteVector(env, data.obj(), &out); |
227 EXPECT_EQ(data_bytes->data().size(), out.size()); | 226 EXPECT_EQ(data_bytes->data().size(), out.size()); |
228 EXPECT_EQ(data_bytes->data()[0], out[0]); | 227 EXPECT_EQ(data_bytes->data()[0], out[0]); |
229 cursor->Destroy(env, NULL); | 228 cursor->Destroy(env, NULL); |
230 // Cursor::Destroy posts the task in UI thread, run Message loop to release | 229 // Cursor::Destroy posts the task in UI thread, run Message loop to release |
231 // the statement, delete SQLiteCursor itself etc. | 230 // the statement, delete SQLiteCursor itself etc. |
232 content::RunAllPendingInMessageLoop(); | 231 content::RunAllPendingInMessageLoop(); |
233 } | 232 } |
OLD | NEW |