Plan cloud transfer requests
This commit is contained in:
@@ -157,6 +157,78 @@ void cloud_bulk_upload_clamps_progress_total(pp::tests::Harness& harness)
|
||||
PP_EXPECT(harness, plan.show_progress);
|
||||
}
|
||||
|
||||
void cloud_download_transfer_rejects_missing_url(pp::tests::Harness& harness)
|
||||
{
|
||||
const auto plan = pp::app::plan_cloud_download_transfer("", "D:/Paint/demo.ppi", true, true);
|
||||
PP_EXPECT(harness, plan.direction == pp::app::CloudTransferDirection::download);
|
||||
PP_EXPECT(harness, plan.action == pp::app::CloudTransferAction::reject_missing_source);
|
||||
PP_EXPECT(harness, !plan.enable_progress);
|
||||
PP_EXPECT(harness, !plan.disable_tls_verification);
|
||||
}
|
||||
|
||||
void cloud_download_transfer_rejects_missing_destination(pp::tests::Harness& harness)
|
||||
{
|
||||
const auto plan = pp::app::plan_cloud_download_transfer("https://example.invalid/demo.ppi", "", true, true);
|
||||
PP_EXPECT(harness, plan.direction == pp::app::CloudTransferDirection::download);
|
||||
PP_EXPECT(harness, plan.action == pp::app::CloudTransferAction::reject_missing_destination);
|
||||
PP_EXPECT(harness, !plan.enable_progress);
|
||||
PP_EXPECT(harness, !plan.disable_tls_verification);
|
||||
}
|
||||
|
||||
void cloud_download_transfer_starts_with_progress_and_tls_policy(pp::tests::Harness& harness)
|
||||
{
|
||||
const auto plan = pp::app::plan_cloud_download_transfer(
|
||||
"https://example.invalid/demo.ppi",
|
||||
"D:/Paint/demo.ppi",
|
||||
true,
|
||||
true);
|
||||
PP_EXPECT(harness, plan.direction == pp::app::CloudTransferDirection::download);
|
||||
PP_EXPECT(harness, plan.action == pp::app::CloudTransferAction::start_transfer);
|
||||
PP_EXPECT(harness, plan.enable_progress);
|
||||
PP_EXPECT(harness, plan.disable_tls_verification);
|
||||
}
|
||||
|
||||
void cloud_upload_transfer_rejects_missing_file(pp::tests::Harness& harness)
|
||||
{
|
||||
const auto plan = pp::app::plan_cloud_upload_transfer("", true, true);
|
||||
PP_EXPECT(harness, plan.direction == pp::app::CloudTransferDirection::upload);
|
||||
PP_EXPECT(harness, plan.action == pp::app::CloudTransferAction::reject_missing_source);
|
||||
PP_EXPECT(harness, !plan.enable_progress);
|
||||
PP_EXPECT(harness, !plan.disable_tls_verification);
|
||||
}
|
||||
|
||||
void cloud_upload_transfer_starts_with_progress_and_tls_policy(pp::tests::Harness& harness)
|
||||
{
|
||||
const auto plan = pp::app::plan_cloud_upload_transfer("D:/Paint/demo.ppi", true, false);
|
||||
PP_EXPECT(harness, plan.direction == pp::app::CloudTransferDirection::upload);
|
||||
PP_EXPECT(harness, plan.action == pp::app::CloudTransferAction::start_transfer);
|
||||
PP_EXPECT(harness, plan.enable_progress);
|
||||
PP_EXPECT(harness, !plan.disable_tls_verification);
|
||||
}
|
||||
|
||||
void cloud_transfer_progress_ignores_unknown_total(pp::tests::Harness& harness)
|
||||
{
|
||||
const auto zero = pp::app::plan_cloud_transfer_progress(0, 4);
|
||||
const auto negative = pp::app::plan_cloud_transfer_progress(-10, 4);
|
||||
PP_EXPECT(harness, !zero.notify);
|
||||
PP_EXPECT(harness, zero.fraction == 0.0F);
|
||||
PP_EXPECT(harness, !negative.notify);
|
||||
PP_EXPECT(harness, negative.fraction == 0.0F);
|
||||
}
|
||||
|
||||
void cloud_transfer_progress_clamps_to_valid_fraction(pp::tests::Harness& harness)
|
||||
{
|
||||
const auto before_start = pp::app::plan_cloud_transfer_progress(10, -2);
|
||||
const auto half = pp::app::plan_cloud_transfer_progress(10, 5);
|
||||
const auto after_end = pp::app::plan_cloud_transfer_progress(10, 20);
|
||||
PP_EXPECT(harness, before_start.notify);
|
||||
PP_EXPECT(harness, before_start.fraction == 0.0F);
|
||||
PP_EXPECT(harness, half.notify);
|
||||
PP_EXPECT(harness, half.fraction == 0.5F);
|
||||
PP_EXPECT(harness, after_end.notify);
|
||||
PP_EXPECT(harness, after_end.fraction == 1.0F);
|
||||
}
|
||||
|
||||
void executor_dispatches_cloud_upload_variants(pp::tests::Harness& harness)
|
||||
{
|
||||
FakeCloudServices services;
|
||||
@@ -247,6 +319,13 @@ int main()
|
||||
harness.run("cloud bulk upload runs without progress when ui unavailable", cloud_bulk_upload_runs_without_progress_when_ui_unavailable);
|
||||
harness.run("cloud bulk upload keeps zero file progress explicit", cloud_bulk_upload_keeps_zero_file_progress_explicit);
|
||||
harness.run("cloud bulk upload clamps progress total", cloud_bulk_upload_clamps_progress_total);
|
||||
harness.run("cloud download transfer rejects missing url", cloud_download_transfer_rejects_missing_url);
|
||||
harness.run("cloud download transfer rejects missing destination", cloud_download_transfer_rejects_missing_destination);
|
||||
harness.run("cloud download transfer starts with progress and tls policy", cloud_download_transfer_starts_with_progress_and_tls_policy);
|
||||
harness.run("cloud upload transfer rejects missing file", cloud_upload_transfer_rejects_missing_file);
|
||||
harness.run("cloud upload transfer starts with progress and tls policy", cloud_upload_transfer_starts_with_progress_and_tls_policy);
|
||||
harness.run("cloud transfer progress ignores unknown total", cloud_transfer_progress_ignores_unknown_total);
|
||||
harness.run("cloud transfer progress clamps to valid fraction", cloud_transfer_progress_clamps_to_valid_fraction);
|
||||
harness.run("executor dispatches cloud upload variants", executor_dispatches_cloud_upload_variants);
|
||||
harness.run("executor dispatches cloud bulk browse and download", executor_dispatches_cloud_bulk_browse_and_download);
|
||||
harness.run("executor rejects mismatched download action", executor_rejects_mismatched_download_action);
|
||||
|
||||
Reference in New Issue
Block a user