| 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 4a4617f33a79aa535699c0714853f37735e899ca..b7d7210d6f87a83b9c67452c64745616ef2f5cbb 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
|
| @@ -2,59 +2,29 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include <list>
|
| -#include <utility>
|
| -#include "base/compiler_specific.h"
|
| -#include "base/file_util.h"
|
| -#include "base/files/file_path.h"
|
| -#include "base/memory/scoped_vector.h"
|
| -#include "base/message_loop.h"
|
| -#include "base/path_service.h"
|
| -#include "base/strings/string_number_conversions.h"
|
| -#include "base/strings/stringprintf.h"
|
| -#include "base/values.h"
|
| -#include "chrome/browser/chrome_notification_types.h"
|
| #include "chrome/browser/component_updater/component_updater_service.h"
|
| -#include "chrome/browser/component_updater/test/component_patcher_mock.h"
|
| #include "chrome/browser/component_updater/test/component_updater_service_unittest.h"
|
| #include "chrome/browser/component_updater/test/test_installer.h"
|
| -#include "chrome/common/chrome_paths.h"
|
| -#include "content/public/browser/notification_observer.h"
|
| -#include "content/public/browser/notification_service.h"
|
| -#include "content/public/test/test_browser_thread.h"
|
| -#include "content/public/test/test_notification_tracker.h"
|
| #include "content/test/net/url_request_prepackaged_interceptor.h"
|
| -#include "libxml/globals.h"
|
| -#include "net/base/upload_bytes_element_reader.h"
|
| -#include "net/url_request/url_fetcher.h"
|
| -#include "net/url_request/url_request.h"
|
| -#include "net/url_request/url_request_filter.h"
|
| -#include "net/url_request/url_request_simple_job.h"
|
| -#include "net/url_request/url_request_test_util.h"
|
| -#include "testing/gtest/include/gtest/gtest.h"
|
| -#include "url/gurl.h"
|
| -
|
| -using content::BrowserThread;
|
| -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);
|
| - content::TestBrowserThread file_thread(BrowserThread::FILE);
|
| - content::TestBrowserThread io_thread(BrowserThread::IO);
|
| -
|
| - 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;
|
| @@ -90,12 +60,15 @@ TEST_F(ComponentUpdaterTest, DifferentialUpdate) {
|
| test_configurator()->SetLoopCount(3);
|
|
|
| component_updater()->Start();
|
| - message_loop.Run();
|
| + message_loop_.Run();
|
|
|
| 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();
|
| }
|
| +
|
|
|