Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1719)

Unified Diff: chrome/browser/history/android/sqlite_cursor_unittest.cc

Issue 15701011: Only wait for CancelAllRequests done if the post task succeeds (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync again Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/history/android/sqlite_cursor.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/android/sqlite_cursor_unittest.cc
diff --git a/chrome/browser/history/android/sqlite_cursor_unittest.cc b/chrome/browser/history/android/sqlite_cursor_unittest.cc
index 47cade3f52e1183e05ad39857be9ff0e4201548f..2e955f7aa5439dc0ecec9efa0afc1718201c91e3 100644
--- a/chrome/browser/history/android/sqlite_cursor_unittest.cc
+++ b/chrome/browser/history/android/sqlite_cursor_unittest.cc
@@ -197,28 +197,25 @@ TEST_F(SQLiteCursorTest, Run) {
FaviconService* favicon_service = new FaviconService(hs_);
- // Wraps cursor in a block, so the destructor will be called after that.
- {
- SQLiteCursor cursor(column_names, statement, service_.get(),
- favicon_service);
- cursor.set_test_observer(this);
- JNIEnv* env = base::android::AttachCurrentThread();
- EXPECT_EQ(1, cursor.GetCount(env, NULL));
- EXPECT_EQ(0, cursor.MoveTo(env, NULL, 0));
- EXPECT_EQ(row.url().spec(), base::android::ConvertJavaStringToUTF8(
- cursor.GetString(env, NULL, 0)).c_str());
- EXPECT_EQ(history::ToDatabaseTime(row.last_visit_time()),
- cursor.GetLong(env, NULL, 1));
- EXPECT_EQ(row.visit_count(), cursor.GetInt(env, NULL, 2));
- base::android::ScopedJavaLocalRef<jbyteArray> data =
- cursor.GetBlob(env, NULL, 3);
- std::vector<uint8> out;
- base::android::JavaByteArrayToByteVector(env, data.obj(), &out);
- EXPECT_EQ(data_bytes->data().size(), out.size());
- EXPECT_EQ(data_bytes->data()[0], out[0]);
- }
-
- // Cursor's destructor post the task in UI thread, run Message loop to release
- // the statement etc.
+ SQLiteCursor* cursor = new SQLiteCursor(column_names, statement,
+ service_.get(), favicon_service);
+ cursor->set_test_observer(this);
+ JNIEnv* env = base::android::AttachCurrentThread();
+ EXPECT_EQ(1, cursor->GetCount(env, NULL));
+ EXPECT_EQ(0, cursor->MoveTo(env, NULL, 0));
+ EXPECT_EQ(row.url().spec(), base::android::ConvertJavaStringToUTF8(
+ cursor->GetString(env, NULL, 0)).c_str());
+ EXPECT_EQ(history::ToDatabaseTime(row.last_visit_time()),
+ cursor->GetLong(env, NULL, 1));
+ EXPECT_EQ(row.visit_count(), cursor->GetInt(env, NULL, 2));
+ base::android::ScopedJavaLocalRef<jbyteArray> data =
+ cursor->GetBlob(env, NULL, 3);
+ std::vector<uint8> out;
+ base::android::JavaByteArrayToByteVector(env, data.obj(), &out);
+ EXPECT_EQ(data_bytes->data().size(), out.size());
+ EXPECT_EQ(data_bytes->data()[0], out[0]);
+ cursor->Destroy(env, NULL);
+ // Cursor::Destroy posts the task in UI thread, run Message loop to release
+ // the statement, delete SQLiteCursor itself etc.
content::RunAllPendingInMessageLoop();
}
« no previous file with comments | « chrome/browser/history/android/sqlite_cursor.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698