| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
| 7 #include "base/version.h" | 7 #include "base/version.h" |
| 8 #include "chrome/browser/component_updater/component_updater_ping_manager.h" | 8 #include "chrome/browser/component_updater/component_updater_ping_manager.h" |
| 9 #include "chrome/browser/component_updater/crx_update_item.h" | 9 #include "chrome/browser/component_updater/crx_update_item.h" |
| 10 #include "chrome/browser/component_updater/test/component_updater_service_unitte
st.h" | 10 #include "chrome/browser/component_updater/test/component_updater_service_unitte
st.h" |
| 11 #include "chrome/browser/component_updater/test/url_request_post_interceptor.h" | 11 #include "chrome/browser/component_updater/test/url_request_post_interceptor.h" |
| 12 #include "chrome/common/chrome_version_info.h" |
| 12 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 13 #include "content/public/test/test_browser_thread_bundle.h" | 14 #include "content/public/test/test_browser_thread_bundle.h" |
| 14 #include "net/url_request/url_request_test_util.h" | 15 #include "net/url_request/url_request_test_util.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 17 |
| 17 using content::BrowserThread; | 18 using content::BrowserThread; |
| 18 | 19 |
| 19 namespace component_updater { | 20 namespace component_updater { |
| 20 | 21 |
| 21 class ComponentUpdaterPingManagerTest : public testing::Test { | 22 class ComponentUpdaterPingManagerTest : public testing::Test { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 42 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))), | 43 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))), |
| 43 thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { | 44 thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { |
| 44 } | 45 } |
| 45 | 46 |
| 46 ComponentUpdaterPingManagerTest::~ComponentUpdaterPingManagerTest() { | 47 ComponentUpdaterPingManagerTest::~ComponentUpdaterPingManagerTest() { |
| 47 context_ = NULL; | 48 context_ = NULL; |
| 48 } | 49 } |
| 49 | 50 |
| 50 void ComponentUpdaterPingManagerTest::SetUp() { | 51 void ComponentUpdaterPingManagerTest::SetUp() { |
| 51 ping_manager_.reset( | 52 ping_manager_.reset( |
| 52 new PingManager(GURL("http://localhost2/update2"), context_)); | 53 new PingManager(chrome::VersionInfo().Version(), |
| 54 chrome::VersionInfo().OSType(), |
| 55 GURL("http://localhost2/update2"), context_)); |
| 53 } | 56 } |
| 54 | 57 |
| 55 void ComponentUpdaterPingManagerTest::TearDown() { | 58 void ComponentUpdaterPingManagerTest::TearDown() { |
| 56 ping_manager_.reset(); | 59 ping_manager_.reset(); |
| 57 } | 60 } |
| 58 | 61 |
| 59 void ComponentUpdaterPingManagerTest::RunThreadsUntilIdle() { | 62 void ComponentUpdaterPingManagerTest::RunThreadsUntilIdle() { |
| 60 base::RunLoop().RunUntilIdle(); | 63 base::RunLoop().RunUntilIdle(); |
| 61 } | 64 } |
| 62 | 65 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 "errorcode=\"-1\" url=\"http://host1/path1\" downloaded=\"123\" " | 176 "errorcode=\"-1\" url=\"http://host1/path1\" downloaded=\"123\" " |
| 174 "total=\"456\" download_time_ms=\"987\"/>" | 177 "total=\"456\" download_time_ms=\"987\"/>" |
| 175 "<event eventtype=\"14\" eventresult=\"1\" downloader=\"bits\" " | 178 "<event eventtype=\"14\" eventresult=\"1\" downloader=\"bits\" " |
| 176 "url=\"http://host2/path2\" downloaded=\"1230\" total=\"4560\" " | 179 "url=\"http://host2/path2\" downloaded=\"1230\" total=\"4560\" " |
| 177 "download_time_ms=\"9870\"/></app>")) | 180 "download_time_ms=\"9870\"/></app>")) |
| 178 << interceptor->GetRequestsAsString(); | 181 << interceptor->GetRequestsAsString(); |
| 179 interceptor->Reset(); | 182 interceptor->Reset(); |
| 180 } | 183 } |
| 181 | 184 |
| 182 } // namespace component_updater | 185 } // namespace component_updater |
| OLD | NEW |