| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 testing_profile_ = profile_manager_.CreateTestingProfile( | 61 testing_profile_ = profile_manager_.CreateTestingProfile( |
| 62 chrome::kInitialProfile); | 62 chrome::kInitialProfile); |
| 63 | 63 |
| 64 testing_profile_->CreateBookmarkModel(true); | 64 testing_profile_->CreateBookmarkModel(true); |
| 65 bookmarks::test::WaitForBookmarkModelToLoad( | 65 bookmarks::test::WaitForBookmarkModelToLoad( |
| 66 BookmarkModelFactory::GetForProfile(testing_profile_)); | 66 BookmarkModelFactory::GetForProfile(testing_profile_)); |
| 67 | 67 |
| 68 testing_profile_->CreateFaviconService(); | 68 testing_profile_->CreateFaviconService(); |
| 69 ASSERT_TRUE(testing_profile_->CreateHistoryService(true, false)); | 69 ASSERT_TRUE(testing_profile_->CreateHistoryService(true, false)); |
| 70 service_.reset(new AndroidHistoryProviderService(testing_profile_)); | 70 service_.reset(new AndroidHistoryProviderService(testing_profile_)); |
| 71 hs_ = HistoryServiceFactory::GetForProfile(testing_profile_, | 71 hs_ = HistoryServiceFactory::GetForProfile( |
| 72 Profile::EXPLICIT_ACCESS); | 72 testing_profile_, ServiceAccessType::EXPLICIT_ACCESS); |
| 73 } | 73 } |
| 74 | 74 |
| 75 virtual void TearDown() override { | 75 virtual void TearDown() override { |
| 76 testing_profile_->DestroyHistoryService(); | 76 testing_profile_->DestroyHistoryService(); |
| 77 profile_manager_.DeleteTestingProfile(chrome::kInitialProfile); | 77 profile_manager_.DeleteTestingProfile(chrome::kInitialProfile); |
| 78 testing_profile_ = NULL; | 78 testing_profile_ = NULL; |
| 79 } | 79 } |
| 80 | 80 |
| 81 // Override SQLiteCursor::TestObserver. | 81 // Override SQLiteCursor::TestObserver. |
| 82 virtual void OnPostMoveToTask() override { | 82 virtual void OnPostMoveToTask() override { |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 cursor->GetBlob(env, NULL, 3); | 215 cursor->GetBlob(env, NULL, 3); |
| 216 std::vector<uint8> out; | 216 std::vector<uint8> out; |
| 217 base::android::JavaByteArrayToByteVector(env, data.obj(), &out); | 217 base::android::JavaByteArrayToByteVector(env, data.obj(), &out); |
| 218 EXPECT_EQ(data_bytes->data().size(), out.size()); | 218 EXPECT_EQ(data_bytes->data().size(), out.size()); |
| 219 EXPECT_EQ(data_bytes->data()[0], out[0]); | 219 EXPECT_EQ(data_bytes->data()[0], out[0]); |
| 220 cursor->Destroy(env, NULL); | 220 cursor->Destroy(env, NULL); |
| 221 // Cursor::Destroy posts the task in UI thread, run Message loop to release | 221 // Cursor::Destroy posts the task in UI thread, run Message loop to release |
| 222 // the statement, delete SQLiteCursor itself etc. | 222 // the statement, delete SQLiteCursor itself etc. |
| 223 content::RunAllPendingInMessageLoop(); | 223 content::RunAllPendingInMessageLoop(); |
| 224 } | 224 } |
| OLD | NEW |