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

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

Issue 703123003: [fsp] Pass more detailed errors to the providing extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed a bug. Created 6 years, 1 month 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 b2363c3db32dd99a82376ab2d7b338dc29512eb4..4bb833999b75eba93ac4e25ab95adb0aa172b622 100644
--- a/chrome/browser/chromeos/file_system_provider/request_manager_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/request_manager_unittest.cc
@@ -377,9 +377,9 @@ TEST_F(FileSystemProviderRequestManagerTest, CreateAndFulFill) {
RequestValue::CreateForTesting("i-like-vanilla"));
const bool has_more = false;
- bool result =
+ const base::File::Error result =
request_manager_->FulfillRequest(request_id, response.Pass(), has_more);
- EXPECT_TRUE(result);
+ EXPECT_EQ(base::File::FILE_OK, result);
ASSERT_EQ(1u, observer.fulfilled().size());
EXPECT_EQ(request_id, observer.fulfilled()[0].request_id());
@@ -402,19 +402,18 @@ TEST_F(FileSystemProviderRequestManagerTest, CreateAndFulFill) {
request_manager_->GetActiveRequestIds();
EXPECT_EQ(0u, active_request_ids.size());
- bool retry = request_manager_->FulfillRequest(
+ const base::File::Error retry = request_manager_->FulfillRequest(
request_id, scoped_ptr<RequestValue>(new RequestValue), has_more);
- EXPECT_FALSE(retry);
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, retry);
EXPECT_EQ(1u, observer.fulfilled().size());
}
// Rejecting should also fail.
{
- bool retry = request_manager_->RejectRequest(
- request_id,
- scoped_ptr<RequestValue>(new RequestValue()),
+ const base::File::Error retry = request_manager_->RejectRequest(
+ request_id, scoped_ptr<RequestValue>(new RequestValue()),
base::File::FILE_ERROR_FAILED);
- EXPECT_FALSE(retry);
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, retry);
EXPECT_EQ(0u, observer.rejected().size());
}
@@ -448,9 +447,9 @@ TEST_F(FileSystemProviderRequestManagerTest, CreateAndFulFill_WithHasNext) {
const bool has_more = true;
- bool result = request_manager_->FulfillRequest(
+ const base::File::Error result = request_manager_->FulfillRequest(
request_id, scoped_ptr<RequestValue>(new RequestValue), has_more);
- EXPECT_TRUE(result);
+ EXPECT_EQ(base::File::FILE_OK, result);
// Validate if the callback has correct arguments.
ASSERT_EQ(1u, logger.success_events().size());
@@ -471,10 +470,10 @@ TEST_F(FileSystemProviderRequestManagerTest, CreateAndFulFill_WithHasNext) {
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(
+ const bool new_has_more = false;
+ const base::File::Error retry = request_manager_->FulfillRequest(
request_id, scoped_ptr<RequestValue>(new RequestValue), new_has_more);
- EXPECT_TRUE(retry);
+ EXPECT_EQ(base::File::FILE_OK, retry);
ASSERT_EQ(2u, observer.fulfilled().size());
EXPECT_EQ(request_id, observer.fulfilled()[1].request_id());
@@ -488,10 +487,10 @@ TEST_F(FileSystemProviderRequestManagerTest, CreateAndFulFill_WithHasNext) {
request_manager_->GetActiveRequestIds();
EXPECT_EQ(0u, active_request_ids.size());
- bool new_has_more = false;
- bool retry = request_manager_->FulfillRequest(
+ const bool new_has_more = false;
+ const base::File::Error retry = request_manager_->FulfillRequest(
request_id, scoped_ptr<RequestValue>(new RequestValue), new_has_more);
- EXPECT_FALSE(retry);
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, retry);
EXPECT_EQ(0u, observer.rejected().size());
}
@@ -523,10 +522,10 @@ TEST_F(FileSystemProviderRequestManagerTest, CreateAndReject) {
ASSERT_EQ(1u, observer.executed().size());
EXPECT_EQ(request_id, observer.executed()[0].request_id());
- base::File::Error error = base::File::FILE_ERROR_NO_MEMORY;
- bool result = request_manager_->RejectRequest(
+ const base::File::Error error = base::File::FILE_ERROR_NO_MEMORY;
+ const base::File::Error result = request_manager_->RejectRequest(
request_id, scoped_ptr<RequestValue>(new RequestValue()), error);
- EXPECT_TRUE(result);
+ EXPECT_EQ(base::File::FILE_OK, result);
// Validate if the callback has correct arguments.
ASSERT_EQ(1u, logger.error_events().size());
@@ -541,18 +540,18 @@ TEST_F(FileSystemProviderRequestManagerTest, CreateAndReject) {
// Confirm, that the request is removed. Basically, fulfilling again for the
// same request, should fail.
{
- bool has_more = false;
- bool retry = request_manager_->FulfillRequest(
+ const bool has_more = false;
+ const base::File::Error retry = request_manager_->FulfillRequest(
request_id, scoped_ptr<RequestValue>(new RequestValue), has_more);
- EXPECT_FALSE(retry);
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, retry);
EXPECT_EQ(0u, observer.fulfilled().size());
}
// Rejecting should also fail.
{
- bool retry = request_manager_->RejectRequest(
+ const base::File::Error retry = request_manager_->RejectRequest(
request_id, scoped_ptr<RequestValue>(new RequestValue()), error);
- EXPECT_FALSE(retry);
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, retry);
EXPECT_EQ(1u, observer.rejected().size());
}
@@ -587,9 +586,9 @@ TEST_F(FileSystemProviderRequestManagerTest,
const bool has_more = true;
- const bool result = request_manager_->FulfillRequest(
+ const base::File::Error result = request_manager_->FulfillRequest(
request_id + 1, scoped_ptr<RequestValue>(new RequestValue), has_more);
- EXPECT_FALSE(result);
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, result);
// Callbacks should not be called.
EXPECT_EQ(0u, logger.error_events().size());
@@ -600,9 +599,9 @@ TEST_F(FileSystemProviderRequestManagerTest,
// Confirm, that the request hasn't been removed, by fulfilling it correctly.
{
- const bool retry = request_manager_->FulfillRequest(
+ const base::File::Error retry = request_manager_->FulfillRequest(
request_id, scoped_ptr<RequestValue>(new RequestValue), has_more);
- EXPECT_TRUE(retry);
+ EXPECT_EQ(base::File::FILE_OK, retry);
EXPECT_EQ(1u, observer.fulfilled().size());
}
@@ -631,10 +630,10 @@ TEST_F(FileSystemProviderRequestManagerTest,
ASSERT_EQ(1u, observer.executed().size());
EXPECT_EQ(request_id, observer.executed()[0].request_id());
- base::File::Error error = base::File::FILE_ERROR_NO_MEMORY;
- bool result = request_manager_->RejectRequest(
+ const base::File::Error error = base::File::FILE_ERROR_NO_MEMORY;
+ const base::File::Error result = request_manager_->RejectRequest(
request_id + 1, scoped_ptr<RequestValue>(new RequestValue()), error);
- EXPECT_FALSE(result);
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, result);
// Callbacks should not be called.
EXPECT_EQ(0u, logger.error_events().size());
@@ -644,9 +643,9 @@ TEST_F(FileSystemProviderRequestManagerTest,
// Confirm, that the request hasn't been removed, by rejecting it correctly.
{
- bool retry = request_manager_->RejectRequest(
+ const base::File::Error retry = request_manager_->RejectRequest(
request_id, scoped_ptr<RequestValue>(new RequestValue()), error);
- EXPECT_TRUE(retry);
+ EXPECT_EQ(base::File::FILE_OK, retry);
EXPECT_EQ(1u, observer.rejected().size());
}

Powered by Google App Engine
This is Rietveld 408576698