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

Unified Diff: chrome/browser/component_updater/test/component_updater_service_unittest_win.cc

Issue 18516010: Implemented completion pings for component updates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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/component_updater/test/component_updater_service_unittest_win.cc
diff --git a/chrome/browser/component_updater/test/component_updater_service_unittest_win.cc b/chrome/browser/component_updater/test/component_updater_service_unittest_win.cc
index 973f037d1e0ac8216d38020d8e06ae21134fc6b0..2303d3011bd833edd5d690537de12e1a72939016 100644
--- a/chrome/browser/component_updater/test/component_updater_service_unittest_win.cc
+++ b/chrome/browser/component_updater/test/component_updater_service_unittest_win.cc
@@ -40,12 +40,14 @@ using content::TestNotificationTracker;
// Verify that we can download and install a component and a differential
// update to that component. We do three loops; the final loop should do
// nothing.
-// We also check that exactly 5 network requests are issued:
+// We also check that exactly 5 non-ping network requests are issued:
// 1- update check (response: v1 available)
// 2- download crx (v1)
// 3- update check (response: v2 available)
// 4- download differential crx (v1 to v2)
// 5- update check (response: no further update available)
+// There should be two pings, one for each update. The second will bear a
+// diffresult=1, while the first will not.
TEST_F(ComponentUpdaterTest, DifferentialUpdate) {
base::MessageLoop message_loop;
content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop);
@@ -55,6 +57,12 @@ TEST_F(ComponentUpdaterTest, DifferentialUpdate) {
io_thread.StartIOThread();
file_thread.Start();
+ std::map<std::string, std::string> map;
+ map.insert(std::pair<std::string, std::string>("eventtype", "\"3\""));
+ map.insert(std::pair<std::string, std::string>("eventresult", "\"1\""));
+ map.insert(std::pair<std::string, std::string>("diffresult", "\"1\""));
+ PingChecker ping_checker(map);
+ URLRequestPostInterceptor post_interceptor(&ping_checker);
content::URLLocalHostRequestPrepackagedInterceptor interceptor;
VersionedTestInstaller installer;
@@ -95,7 +103,10 @@ TEST_F(ComponentUpdaterTest, DifferentialUpdate) {
EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->error());
EXPECT_EQ(2, static_cast<TestInstaller*>(com.installer)->install_count());
+ EXPECT_EQ(1, ping_checker.NumHits());
+ EXPECT_EQ(1, ping_checker.NumMisses());
EXPECT_EQ(5, interceptor.GetHitCount());
component_updater()->Stop();
}
+

Powered by Google App Engine
This is Rietveld 408576698