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

Unified Diff: chrome/browser/safe_browsing/srt_fetcher_browsertest_win.cc

Issue 2669393003: Check the SRT logs upload time for an entire queue of SRT invocations at once. (Closed)
Patch Set: Fix nits Created 3 years, 10 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 | « no previous file | chrome/browser/safe_browsing/srt_fetcher_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/srt_fetcher_browsertest_win.cc
diff --git a/chrome/browser/safe_browsing/srt_fetcher_browsertest_win.cc b/chrome/browser/safe_browsing/srt_fetcher_browsertest_win.cc
index 1d29cb9f561162be3a6dce60cda0173215de0896..baa5b9d24351d113ffd4b769905aad95feb2a445 100644
--- a/chrome/browser/safe_browsing/srt_fetcher_browsertest_win.cc
+++ b/chrome/browser/safe_browsing/srt_fetcher_browsertest_win.cc
@@ -597,4 +597,42 @@ IN_PROC_BROWSER_TEST_F(SRTFetcherTest, ReporterLogging_EnabledRecentlyLogged) {
EXPECT_EQ(last_time_sent_logs, GetLastTimeSentReport());
}
+IN_PROC_BROWSER_TEST_F(SRTFetcherTest, ReporterLogging_MultipleLaunches) {
+ exit_code_to_report_ = kSwReporterNothingFound;
+ base::test::ScopedFeatureList scoped_feature_list;
+ EnableSBExtendedReporting();
+ SetLastTimeSentReport(kDaysBetweenReporterLogsSent + 3);
+
+ const base::FilePath path1(L"path1");
+ const base::FilePath path2(L"path2");
+ SwReporterQueue invocations;
+ for (auto path : {path1, path2}) {
Sorin Jianu 2017/02/06 18:31:44 do we want to use auto& to avoid a copy here?
Joe Mason 2017/02/06 18:50:52 Good idea. Done.
+ auto invocation = SwReporterInvocation::FromFilePath(path);
+ invocation.supported_behaviours =
+ SwReporterInvocation::BEHAVIOUR_ALLOW_SEND_REPORTER_LOGS;
+ invocations.push(invocation);
+ }
+ RunReporterQueue(invocations);
+
+ // SBER is enabled and last time logs were sent was more than
+ // |kDaysBetweenReporterLogsSent| day ago, so we should send logs in this run.
+ {
+ SCOPED_TRACE("first launch");
+ TestPartialLaunchCycle({path1});
+ ExpectLoggingSwitches(std::set<std::string>(std::begin(kExpectedSwitches),
+ std::end(kExpectedSwitches)));
+ ExpectLastReportSentInTheLastHour();
+ }
+
+ // Logs should also be sent for the next run, even though LastTimeSentReport
+ // is now recent, because the run is part of the same set of invocations.
+ {
+ SCOPED_TRACE("second launch");
+ TestReporterLaunchCycle({path2});
+ ExpectLoggingSwitches(std::set<std::string>(std::begin(kExpectedSwitches),
+ std::end(kExpectedSwitches)));
+ ExpectLastReportSentInTheLastHour();
+ }
+}
+
} // namespace safe_browsing
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/srt_fetcher_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698