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 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // Setup the testing profile, so the bookmark_model_sql_handler could | 57 // Setup the testing profile, so the bookmark_model_sql_handler could |
58 // get the bookmark model from it. | 58 // get the bookmark model from it. |
59 ASSERT_TRUE(profile_manager_.SetUp()); | 59 ASSERT_TRUE(profile_manager_.SetUp()); |
60 // It seems that the name has to be chrome::kInitialProfile, so it | 60 // It seems that the name has to be chrome::kInitialProfile, so it |
61 // could be found by ProfileManager::GetLastUsedProfile(). | 61 // could be found by ProfileManager::GetLastUsedProfile(). |
62 testing_profile_ = profile_manager_.CreateTestingProfile( | 62 testing_profile_ = profile_manager_.CreateTestingProfile( |
63 chrome::kInitialProfile); | 63 chrome::kInitialProfile); |
64 | 64 |
65 testing_profile_->CreateBookmarkModel(true); | 65 testing_profile_->CreateBookmarkModel(true); |
66 bookmarks::test::WaitForBookmarkModelToLoad( | 66 bookmarks::test::WaitForBookmarkModelToLoad( |
67 BookmarkModelFactory::GetForProfile(testing_profile_)); | 67 BookmarkModelFactory::GetForBrowserContext(testing_profile_)); |
68 | 68 |
69 testing_profile_->CreateFaviconService(); | 69 testing_profile_->CreateFaviconService(); |
70 ASSERT_TRUE(testing_profile_->CreateHistoryService(true, false)); | 70 ASSERT_TRUE(testing_profile_->CreateHistoryService(true, false)); |
71 service_.reset(new AndroidHistoryProviderService(testing_profile_)); | 71 service_.reset(new AndroidHistoryProviderService(testing_profile_)); |
72 hs_ = HistoryServiceFactory::GetForProfile( | 72 hs_ = HistoryServiceFactory::GetForProfile( |
73 testing_profile_, ServiceAccessType::EXPLICIT_ACCESS); | 73 testing_profile_, ServiceAccessType::EXPLICIT_ACCESS); |
74 } | 74 } |
75 | 75 |
76 void TearDown() override { | 76 void TearDown() override { |
77 testing_profile_->DestroyHistoryService(); | 77 testing_profile_->DestroyHistoryService(); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 cursor->GetBlob(env, NULL, 3); | 211 cursor->GetBlob(env, NULL, 3); |
212 std::vector<uint8_t> out; | 212 std::vector<uint8_t> out; |
213 base::android::JavaByteArrayToByteVector(env, data.obj(), &out); | 213 base::android::JavaByteArrayToByteVector(env, data.obj(), &out); |
214 EXPECT_EQ(data_bytes->data().size(), out.size()); | 214 EXPECT_EQ(data_bytes->data().size(), out.size()); |
215 EXPECT_EQ(data_bytes->data()[0], out[0]); | 215 EXPECT_EQ(data_bytes->data()[0], out[0]); |
216 cursor->Destroy(env, NULL); | 216 cursor->Destroy(env, NULL); |
217 // Cursor::Destroy posts the task in UI thread, run Message loop to release | 217 // Cursor::Destroy posts the task in UI thread, run Message loop to release |
218 // the statement, delete SQLiteCursor itself etc. | 218 // the statement, delete SQLiteCursor itself etc. |
219 content::RunAllPendingInMessageLoop(); | 219 content::RunAllPendingInMessageLoop(); |
220 } | 220 } |
OLD | NEW |