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

Side by Side Diff: components/update_client/ping_manager_unittest.cc

Issue 1144153004: components: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 6 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 unified diff | Download patch
OLDNEW
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/ref_counted.h" 5 #include "base/memory/ref_counted.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/thread_task_runner_handle.h"
9 #include "base/version.h" 9 #include "base/version.h"
10 #include "components/update_client/crx_update_item.h" 10 #include "components/update_client/crx_update_item.h"
11 #include "components/update_client/ping_manager.h" 11 #include "components/update_client/ping_manager.h"
12 #include "components/update_client/test_configurator.h" 12 #include "components/update_client/test_configurator.h"
13 #include "components/update_client/url_request_post_interceptor.h" 13 #include "components/update_client/url_request_post_interceptor.h"
14 #include "net/url_request/url_request_test_util.h" 14 #include "net/url_request/url_request_test_util.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 using std::string; 17 using std::string;
18 18
(...skipping 15 matching lines...) Expand all
34 scoped_ptr<PingManager> ping_manager_; 34 scoped_ptr<PingManager> ping_manager_;
35 35
36 private: 36 private:
37 base::MessageLoopForIO loop_; 37 base::MessageLoopForIO loop_;
38 }; 38 };
39 39
40 ComponentUpdaterPingManagerTest::ComponentUpdaterPingManagerTest() { 40 ComponentUpdaterPingManagerTest::ComponentUpdaterPingManagerTest() {
41 } 41 }
42 42
43 void ComponentUpdaterPingManagerTest::SetUp() { 43 void ComponentUpdaterPingManagerTest::SetUp() {
44 config_ = new TestConfigurator(base::MessageLoopProxy::current(), 44 config_ = new TestConfigurator(base::ThreadTaskRunnerHandle::Get(),
45 base::MessageLoopProxy::current()); 45 base::ThreadTaskRunnerHandle::Get());
46 ping_manager_.reset(new PingManager(*config_)); 46 ping_manager_.reset(new PingManager(*config_));
47 } 47 }
48 48
49 void ComponentUpdaterPingManagerTest::TearDown() { 49 void ComponentUpdaterPingManagerTest::TearDown() {
50 ping_manager_.reset(); 50 ping_manager_.reset();
51 config_ = nullptr; 51 config_ = nullptr;
52 } 52 }
53 53
54 void ComponentUpdaterPingManagerTest::RunThreadsUntilIdle() { 54 void ComponentUpdaterPingManagerTest::RunThreadsUntilIdle() {
55 base::RunLoop().RunUntilIdle(); 55 base::RunLoop().RunUntilIdle();
56 } 56 }
57 57
58 // Test is flaky: http://crbug.com/349547 58 // Test is flaky: http://crbug.com/349547
59 TEST_F(ComponentUpdaterPingManagerTest, DISABLED_PingManagerTest) { 59 TEST_F(ComponentUpdaterPingManagerTest, DISABLED_PingManagerTest) {
60 scoped_ptr<InterceptorFactory> interceptor_factory( 60 scoped_ptr<InterceptorFactory> interceptor_factory(
61 new InterceptorFactory(base::MessageLoopProxy::current())); 61 new InterceptorFactory(base::ThreadTaskRunnerHandle::Get()));
62 URLRequestPostInterceptor* interceptor = 62 URLRequestPostInterceptor* interceptor =
63 interceptor_factory->CreateInterceptor(); 63 interceptor_factory->CreateInterceptor();
64 EXPECT_TRUE(interceptor); 64 EXPECT_TRUE(interceptor);
65 65
66 // Test eventresult="1" is sent for successful updates. 66 // Test eventresult="1" is sent for successful updates.
67 CrxUpdateItem item; 67 CrxUpdateItem item;
68 item.id = "abc"; 68 item.id = "abc";
69 item.state = CrxUpdateItem::State::kUpdated; 69 item.state = CrxUpdateItem::State::kUpdated;
70 item.previous_version = base::Version("1.0"); 70 item.previous_version = base::Version("1.0");
71 item.next_version = base::Version("2.0"); 71 item.next_version = base::Version("2.0");
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 "errorcode=\"-1\" url=\"http://host1/path1\" downloaded=\"123\" " 169 "errorcode=\"-1\" url=\"http://host1/path1\" downloaded=\"123\" "
170 "total=\"456\" download_time_ms=\"987\"/>" 170 "total=\"456\" download_time_ms=\"987\"/>"
171 "<event eventtype=\"14\" eventresult=\"1\" downloader=\"bits\" " 171 "<event eventtype=\"14\" eventresult=\"1\" downloader=\"bits\" "
172 "url=\"http://host2/path2\" downloaded=\"1230\" total=\"4560\" " 172 "url=\"http://host2/path2\" downloaded=\"1230\" total=\"4560\" "
173 "download_time_ms=\"9870\"/></app>")) 173 "download_time_ms=\"9870\"/></app>"))
174 << interceptor->GetRequestsAsString(); 174 << interceptor->GetRequestsAsString();
175 interceptor->Reset(); 175 interceptor->Reset();
176 } 176 }
177 177
178 } // namespace update_client 178 } // namespace update_client
OLDNEW
« no previous file with comments | « components/update_client/crx_downloader_unittest.cc ('k') | components/update_client/request_sender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698