Commit 10f36556 authored by Eugene But's avatar Eugene But Committed by Commit Bot

Added 'Not Started' to DownloadFileResult histogram.

This histogram is logged when the user closes Download Manager UI
without starting the download.

Bug: 791806
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I4e7912e312b1eccbb839207160ed82cbb3d95577
Reviewed-on: https://chromium-review.googlesource.com/981461Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Eugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#546124}
parent d4dfa934
...@@ -34,6 +34,8 @@ enum class DownloadFileResult { ...@@ -34,6 +34,8 @@ enum class DownloadFileResult {
// In progress download did no finish because the tab was closed or user has // In progress download did no finish because the tab was closed or user has
// quit the app. // quit the app.
Other = 3, Other = 3,
// The user closed Download Manager UI without starting the download.
NotStarted = 4,
Count Count
}; };
......
...@@ -227,6 +227,9 @@ class UnopenedDownloadsTracker : public web::DownloadTaskObserver { ...@@ -227,6 +227,9 @@ class UnopenedDownloadsTracker : public web::DownloadTaskObserver {
- (void)downloadManagerViewControllerDidClose: - (void)downloadManagerViewControllerDidClose:
(DownloadManagerViewController*)controller { (DownloadManagerViewController*)controller {
if (_downloadTask->GetState() != web::DownloadTask::State::kInProgress) { if (_downloadTask->GetState() != web::DownloadTask::State::kInProgress) {
UMA_HISTOGRAM_ENUMERATION("Download.IOSDownloadFileResult",
DownloadFileResult::NotStarted,
DownloadFileResult::Count);
[self cancelDownload]; [self cancelDownload];
return; return;
} }
......
...@@ -305,6 +305,10 @@ TEST_F(DownloadManagerCoordinatorTest, Close) { ...@@ -305,6 +305,10 @@ TEST_F(DownloadManagerCoordinatorTest, Close) {
EXPECT_EQ(0U, base_view_controller_.childViewControllers.count); EXPECT_EQ(0U, base_view_controller_.childViewControllers.count);
EXPECT_FALSE(coordinator_.downloadTask); EXPECT_FALSE(coordinator_.downloadTask);
EXPECT_EQ(web::DownloadTask::State::kCancelled, task.GetState()); EXPECT_EQ(web::DownloadTask::State::kCancelled, task.GetState());
histogram_tester_.ExpectUniqueSample(
"Download.IOSDownloadFileResult",
static_cast<base::HistogramBase::Sample>(DownloadFileResult::NotStarted),
1);
} }
// Tests presenting Install Google Drive dialog. Coordinator presents StoreKit // Tests presenting Install Google Drive dialog. Coordinator presents StoreKit
......
...@@ -9961,10 +9961,18 @@ Called by update_net_error_codes.py.--> ...@@ -9961,10 +9961,18 @@ Called by update_net_error_codes.py.-->
</enum> </enum>
<enum name="DownloadFileResult"> <enum name="DownloadFileResult">
<int value="0" label="Completed"/> <int value="0" label="Completed">Download has successfully completed.</int>
<int value="1" label="Canceled"/> <int value="1" label="Canceled">
<int value="2" label="Failure"/> In progress download was cancelled by the user.
<int value="3" label="Other"/> </int>
<int value="2" label="Failure">Download has completed with error.</int>
<int value="3" label="Other">
In progress download did no finish because the tab was closed or user has
quit the app.
</int>
<int value="4" label="Not Started">
The user closed Download Manager UI without starting the download.
</int>
</enum> </enum>
<enum name="DownloadFunctions"> <enum name="DownloadFunctions">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment