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

Unified Diff: chrome/browser/chromeos/file_system_provider/request_manager_unittest.cc

Issue 440653003: [fsp] Add support for aborting running operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed DCHECKs. Created 6 years, 4 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
Index: chrome/browser/chromeos/file_system_provider/request_manager_unittest.cc
diff --git a/chrome/browser/chromeos/file_system_provider/request_manager_unittest.cc b/chrome/browser/chromeos/file_system_provider/request_manager_unittest.cc
index 1e5d6ed695b5323516acda6802cd901df2a09ee0..7209c317f00dccc4cf08eb3d960a73ca0503823e 100644
--- a/chrome/browser/chromeos/file_system_provider/request_manager_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/request_manager_unittest.cc
@@ -340,6 +340,10 @@ TEST_F(FileSystemProviderRequestManagerTest, CreateFailure) {
EXPECT_EQ(1u, observer.destroyed().size());
EXPECT_EQ(0u, observer.executed().size());
+ const std::vector<int> active_request_ids =
+ request_manager_->GetActiveRequestIds();
+ EXPECT_EQ(0u, active_request_ids.size());
+
request_manager_->RemoveObserver(&observer);
}
@@ -364,6 +368,11 @@ TEST_F(FileSystemProviderRequestManagerTest, CreateAndFulFill) {
ASSERT_EQ(1u, observer.executed().size());
EXPECT_EQ(request_id, observer.executed()[0].request_id());
+ const std::vector<int> active_request_ids =
+ request_manager_->GetActiveRequestIds();
+ ASSERT_EQ(1u, active_request_ids.size());
+ EXPECT_EQ(request_id, active_request_ids[0]);
+
scoped_ptr<RequestValue> response(
RequestValue::CreateForTesting("i-like-vanilla"));
const bool has_more = false;
@@ -389,6 +398,10 @@ TEST_F(FileSystemProviderRequestManagerTest, CreateAndFulFill) {
// Confirm, that the request is removed. Basically, fulfilling again for the
// same request, should fail.
{
+ const std::vector<int> active_request_ids =
+ request_manager_->GetActiveRequestIds();
+ EXPECT_EQ(0u, active_request_ids.size());
+
bool retry = request_manager_->FulfillRequest(
request_id, scoped_ptr<RequestValue>(new RequestValue), has_more);
EXPECT_FALSE(retry);
@@ -453,6 +466,11 @@ TEST_F(FileSystemProviderRequestManagerTest, CreateAndFulFill_WithHasNext) {
// Confirm, that the request is not removed (since it has has_more == true).
// Basically, fulfilling again for the same request, should not fail.
{
+ const std::vector<int> active_request_ids =
+ request_manager_->GetActiveRequestIds();
+ ASSERT_EQ(1u, active_request_ids.size());
+ EXPECT_EQ(request_id, active_request_ids[0]);
+
bool new_has_more = false;
bool retry = request_manager_->FulfillRequest(
request_id, scoped_ptr<RequestValue>(new RequestValue), new_has_more);
@@ -466,6 +484,10 @@ TEST_F(FileSystemProviderRequestManagerTest, CreateAndFulFill_WithHasNext) {
// Since |new_has_more| is false, then the request should be removed. To check
// it, try to fulfill again, what should fail.
{
+ const std::vector<int> active_request_ids =
+ request_manager_->GetActiveRequestIds();
+ EXPECT_EQ(0u, active_request_ids.size());
+
bool new_has_more = false;
bool retry = request_manager_->FulfillRequest(
request_id, scoped_ptr<RequestValue>(new RequestValue), new_has_more);

Powered by Google App Engine
This is Rietveld 408576698