| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 ASSERT_TRUE(profile_manager_.SetUp()); | 56 ASSERT_TRUE(profile_manager_.SetUp()); |
| 57 // It seems that the name has to be chrome::kInitialProfile, so it | 57 // It seems that the name has to be chrome::kInitialProfile, so it |
| 58 // could be found by ProfileManager::GetLastUsedProfile(). | 58 // could be found by ProfileManager::GetLastUsedProfile(). |
| 59 testing_profile_ = profile_manager_.CreateTestingProfile( | 59 testing_profile_ = profile_manager_.CreateTestingProfile( |
| 60 chrome::kInitialProfile); | 60 chrome::kInitialProfile); |
| 61 | 61 |
| 62 testing_profile_->CreateBookmarkModel(true); | 62 testing_profile_->CreateBookmarkModel(true); |
| 63 ui_test_utils::WaitForBookmarkModelToLoad(testing_profile_); | 63 ui_test_utils::WaitForBookmarkModelToLoad(testing_profile_); |
| 64 | 64 |
| 65 testing_profile_->CreateFaviconService(); | 65 testing_profile_->CreateFaviconService(); |
| 66 testing_profile_->CreateHistoryService(true, false); | 66 ASSERT_TRUE(testing_profile_->CreateHistoryService(true, false)); |
| 67 service_.reset(new AndroidHistoryProviderService(testing_profile_)); | 67 service_.reset(new AndroidHistoryProviderService(testing_profile_)); |
| 68 hs_ = HistoryServiceFactory::GetForProfile(testing_profile_, | 68 hs_ = HistoryServiceFactory::GetForProfile(testing_profile_, |
| 69 Profile::EXPLICIT_ACCESS); | 69 Profile::EXPLICIT_ACCESS); |
| 70 } | 70 } |
| 71 | 71 |
| 72 virtual void TearDown() OVERRIDE { | 72 virtual void TearDown() OVERRIDE { |
| 73 testing_profile_->DestroyHistoryService(); | 73 testing_profile_->DestroyHistoryService(); |
| 74 profile_manager_.DeleteTestingProfile(chrome::kInitialProfile); | 74 profile_manager_.DeleteTestingProfile(chrome::kInitialProfile); |
| 75 testing_profile_ = NULL; | 75 testing_profile_ = NULL; |
| 76 } | 76 } |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 cursor->GetBlob(env, NULL, 3); | 212 cursor->GetBlob(env, NULL, 3); |
| 213 std::vector<uint8> out; | 213 std::vector<uint8> out; |
| 214 base::android::JavaByteArrayToByteVector(env, data.obj(), &out); | 214 base::android::JavaByteArrayToByteVector(env, data.obj(), &out); |
| 215 EXPECT_EQ(data_bytes->data().size(), out.size()); | 215 EXPECT_EQ(data_bytes->data().size(), out.size()); |
| 216 EXPECT_EQ(data_bytes->data()[0], out[0]); | 216 EXPECT_EQ(data_bytes->data()[0], out[0]); |
| 217 cursor->Destroy(env, NULL); | 217 cursor->Destroy(env, NULL); |
| 218 // Cursor::Destroy posts the task in UI thread, run Message loop to release | 218 // Cursor::Destroy posts the task in UI thread, run Message loop to release |
| 219 // the statement, delete SQLiteCursor itself etc. | 219 // the statement, delete SQLiteCursor itself etc. |
| 220 content::RunAllPendingInMessageLoop(); | 220 content::RunAllPendingInMessageLoop(); |
| 221 } | 221 } |
| OLD | NEW |