|
|
Created:
5 years, 1 month ago by Jitu( very slow this week) Modified:
4 years, 7 months ago CC:
chromium-reviews, zea+watch_chromium.org, Abhishek Base URL:
https://chromium.googlesource.com/chromium/src.git@master Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionComponentize Unit Test for gcm_profile_service
Remove the bad dependencies from gcm_profile_service_unittest.cc.
BUG=519585
Patch Set 1 #
Total comments: 4
Patch Set 2 : Fix comments #
Total comments: 10
Patch Set 3 : Fix comments #Patch Set 4 : #
Total comments: 5
Patch Set 5 : Fix #
Total comments: 4
Patch Set 6 : Fix comments #Patch Set 7 : Rebase and fixed dependancy #Patch Set 8 : Fixed UT crash in GN build #Patch Set 9 : Rebased #
Messages
Total messages: 30 (13 generated)
Description was changed from ========== [WIP] UT Local changes BUG= ========== to ========== [WIP] UT Local changes BUG= ==========
jitendra.ks@samsung.com changed reviewers: + droger@chromium.org
PTAL ... for initial changes. Please let me know how to replace content/browser_thread dependency.
https://codereview.chromium.org/1464463004/diff/1/components/gcm_driver/gcm_p... File components/gcm_driver/gcm_profile_service_unittest.cc (right): https://codereview.chromium.org/1464463004/diff/1/components/gcm_driver/gcm_p... components/gcm_driver/gcm_profile_service_unittest.cc:84: base::Thread io_thread_; Remove task_runner_ and io_thread_ and use a base::MessageLoop instead. https://codereview.chromium.org/1464463004/diff/1/components/gcm_driver/gcm_p... components/gcm_driver/gcm_profile_service_unittest.cc:152: new net::TestURLRequestContextGetter(io_thread_.task_runner()); Use message_loop_.task_runner()
Description was changed from ========== [WIP] UT Local changes BUG= ========== to ========== [WIP] Componentize Unit Test for gcm_profile_service Local changes BUG= ==========
Description was changed from ========== [WIP] Componentize Unit Test for gcm_profile_service Local changes BUG= ========== to ========== Componentize Unit Test for gcm_profile_service Remove the bad dependencies from gcm_profile_service_unittest.cc. BUG=519585 ==========
Patchset #2 (id:20001) has been deleted
Patchset #2 (id:40001) has been deleted
Patchset #2 (id:60001) has been deleted
PTAL ! https://codereview.chromium.org/1464463004/diff/1/components/gcm_driver/gcm_p... File components/gcm_driver/gcm_profile_service_unittest.cc (right): https://codereview.chromium.org/1464463004/diff/1/components/gcm_driver/gcm_p... components/gcm_driver/gcm_profile_service_unittest.cc:84: base::Thread io_thread_; On 2015/11/25 09:19:20, droger wrote: > Remove task_runner_ and io_thread_ and use a base::MessageLoop instead. Done. https://codereview.chromium.org/1464463004/diff/1/components/gcm_driver/gcm_p... components/gcm_driver/gcm_profile_service_unittest.cc:152: new net::TestURLRequestContextGetter(io_thread_.task_runner()); On 2015/11/25 09:19:20, droger wrote: > Use message_loop_.task_runner() Done.
https://codereview.chromium.org/1464463004/diff/80001/components/gcm_driver/g... File components/gcm_driver/gcm_profile_service_unittest.cc (right): https://codereview.chromium.org/1464463004/diff/80001/components/gcm_driver/g... components/gcm_driver/gcm_profile_service_unittest.cc:122: client.reset(new TestSigninClient(&prefs_)); If you do this, the client will be destroyed at the end of SetUp(). The signin_manager_ needs the client to live longer than that. You should probably move client to be a member of the class, so that it outlives the signin manager. Or, if you don't actually need a client, pass a null client instead. https://codereview.chromium.org/1464463004/diff/80001/components/gcm_driver/g... components/gcm_driver/gcm_profile_service_unittest.cc:123: AccountTrackerService tracker; Same for AccountTrackerService, you probably need it to outlive the signin manager. Or if you don't actually need it, just use a null tracker instead. https://codereview.chromium.org/1464463004/diff/80001/components/gcm_driver/g... components/gcm_driver/gcm_profile_service_unittest.cc:163: base::ThreadTaskRunnerHandle::Get(), message_loop_.task_runner(), Nit: I think that message_loop_.task_runner() and base::ThreadTaskRunnerHandle::Get() return the same thing. I would define a variable: scoped_refptr<base::SequencedTaskRunner> task_runner = message_loop_.task_runner(); and use that everywhere. https://codereview.chromium.org/1464463004/diff/80001/components/gcm_driver/g... components/gcm_driver/gcm_profile_service_unittest.cc:164: blocking_task_runner); Does it fail if you use message_loop_.task_runner() instead of blocking_task_runner? If so, what is the failure?
PTAL https://codereview.chromium.org/1464463004/diff/80001/components/gcm_driver/g... File components/gcm_driver/gcm_profile_service_unittest.cc (right): https://codereview.chromium.org/1464463004/diff/80001/components/gcm_driver/g... components/gcm_driver/gcm_profile_service_unittest.cc:122: client.reset(new TestSigninClient(&prefs_)); On 2015/12/14 13:54:34, droger wrote: > If you do this, the client will be destroyed at the end of SetUp(). > The signin_manager_ needs the client to live longer than that. > > You should probably move client to be a member of the class, so that it outlives > the signin manager. > Or, if you don't actually need a client, pass a null client instead. Done. https://codereview.chromium.org/1464463004/diff/80001/components/gcm_driver/g... components/gcm_driver/gcm_profile_service_unittest.cc:123: AccountTrackerService tracker; On 2015/12/14 13:54:34, droger wrote: > Same for AccountTrackerService, you probably need it to outlive the signin > manager. > Or if you don't actually need it, just use a null tracker instead. Done. https://codereview.chromium.org/1464463004/diff/80001/components/gcm_driver/g... components/gcm_driver/gcm_profile_service_unittest.cc:163: base::ThreadTaskRunnerHandle::Get(), message_loop_.task_runner(), On 2015/12/14 13:54:34, droger wrote: > Nit: I think that message_loop_.task_runner() and > base::ThreadTaskRunnerHandle::Get() return the same thing. > I would define a variable: > scoped_refptr<base::SequencedTaskRunner> task_runner = > message_loop_.task_runner(); and use that everywhere. message_loop_.task_runner() and base::ThreadTaskRunnerHandle::Get() returns SingleThreadTaskRunner. Converting base::SequencedTaskRunner gives compilation error https://codereview.chromium.org/1464463004/diff/80001/components/gcm_driver/g... components/gcm_driver/gcm_profile_service_unittest.cc:164: blocking_task_runner); On 2015/12/14 13:54:34, droger wrote: > Does it fail if you use message_loop_.task_runner() instead of > blocking_task_runner? If so, what is the failure? Getting below Compilation error ../../components/gcm_driver/gcm_profile_service_unittest.cc:147:30: error: no matching constructor for initialization of 'gcm::GCMProfileService' gcm_profile_service_ = new gcm::GCMProfileService( ^ ../../components/gcm_driver/gcm_profile_service.h:53:3: note: candidate constructor not viable: no known conversion from 'scoped_refptr<base::SingleThreadTaskRunner>' to 'scoped_refptr<base::SequencedTaskRunner> &' for 9th argument GCMProfileService( ^ ../../components/gcm_driver/gcm_profile_service.h:94:28: note: candidate constructor not viable: requires 1 argument, but 9 were provided DISALLOW_COPY_AND_ASSIGN(GCMProfileService); ^ ../../components/gcm_driver/gcm_profile_service.h:80:3: note: candidate constructor not viable: requires 0 arguments, but 9 were provided GCMProfileService();
https://codereview.chromium.org/1464463004/diff/80001/components/gcm_driver/g... File components/gcm_driver/gcm_profile_service_unittest.cc (right): https://codereview.chromium.org/1464463004/diff/80001/components/gcm_driver/g... components/gcm_driver/gcm_profile_service_unittest.cc:163: base::ThreadTaskRunnerHandle::Get(), message_loop_.task_runner(), On 2015/12/14 14:27:54, Jitu( very slow this week) wrote: > On 2015/12/14 13:54:34, droger wrote: > > Nit: I think that message_loop_.task_runner() and > > base::ThreadTaskRunnerHandle::Get() return the same thing. > > I would define a variable: > > scoped_refptr<base::SequencedTaskRunner> task_runner = > > message_loop_.task_runner(); and use that everywhere. > > message_loop_.task_runner() and > base::ThreadTaskRunnerHandle::Get() returns SingleThreadTaskRunner. > > Converting base::SequencedTaskRunner gives compilation error SingleThreadTaskRunner inherits from SequencedTaskRunner, so you should be able to convert. Maybe try including #include "base/single_thread_task_runner.h" and see if it works. https://codereview.chromium.org/1464463004/diff/80001/components/gcm_driver/g... components/gcm_driver/gcm_profile_service_unittest.cc:164: blocking_task_runner); On 2015/12/14 14:27:54, Jitu( very slow this week) wrote: > On 2015/12/14 13:54:34, droger wrote: > > Does it fail if you use message_loop_.task_runner() instead of > > blocking_task_runner? If so, what is the failure? > > Getting below Compilation error > > ../../components/gcm_driver/gcm_profile_service_unittest.cc:147:30: error: no > matching constructor for initialization of 'gcm::GCMProfileService' > gcm_profile_service_ = new gcm::GCMProfileService( > ^ > ../../components/gcm_driver/gcm_profile_service.h:53:3: note: candidate > constructor not viable: no known conversion from > 'scoped_refptr<base::SingleThreadTaskRunner>' to > 'scoped_refptr<base::SequencedTaskRunner> &' for 9th argument > GCMProfileService( > ^ > ../../components/gcm_driver/gcm_profile_service.h:94:28: note: candidate > constructor not viable: requires 1 argument, but 9 were provided > DISALLOW_COPY_AND_ASSIGN(GCMProfileService); > ^ > ../../components/gcm_driver/gcm_profile_service.h:80:3: note: candidate > constructor not viable: requires 0 arguments, but 9 were provided > GCMProfileService(); Same here, the conversion should work.
PTAL https://codereview.chromium.org/1464463004/diff/120001/components/gcm_driver/... File components/gcm_driver/gcm_profile_service_unittest.cc (right): https://codereview.chromium.org/1464463004/diff/120001/components/gcm_driver/... components/gcm_driver/gcm_profile_service_unittest.cc:139: new net::TestURLRequestContextGetter(message_loop_.task_runner()); Converting to SingleThreadTaskRunner here gives me below error. Please let me know in case any thing wrong here. net::URLRequestContextGetter* request_context = new net::TestURLRequestContextGetter(scoped_refptr<base::SingleThreadTaskRunner> (task_runner)); Error below :: ============== ../../base/memory/ref_counted.h:292:41: error: cannot initialize a member subobject of type 'base::SingleThreadTaskRunner *' with an rvalue of type 'base::SequencedTaskRunner *' scoped_refptr(scoped_refptr<U>&& r) : ptr_(r.get()) { ^ ~~~~~~~ ../../components/gcm_driver/gcm_profile_service_unittest.cc:140:44: note: in instantiation of function template specialization 'scoped_refptr<base::SingleThreadTaskRunner>::scoped_refptr<base::SequencedTaskRunner>' requested here new net::TestURLRequestContextGetter(scoped_refptr<base::SequencedTaskRunner> (task_runner));
https://codereview.chromium.org/1464463004/diff/120001/components/gcm_driver/... File components/gcm_driver/gcm_profile_service_unittest.cc (right): https://codereview.chromium.org/1464463004/diff/120001/components/gcm_driver/... components/gcm_driver/gcm_profile_service_unittest.cc:139: new net::TestURLRequestContextGetter(message_loop_.task_runner()); On 2015/12/15 07:59:49, Jitu( very slow this week) wrote: > Converting to SingleThreadTaskRunner here gives me below error. > Please let me know in case any thing wrong here. > > net::URLRequestContextGetter* request_context = > new > net::TestURLRequestContextGetter(scoped_refptr<base::SingleThreadTaskRunner> > (task_runner)); > > Error below :: > ============== > > ../../base/memory/ref_counted.h:292:41: error: cannot initialize a member > subobject of type 'base::SingleThreadTaskRunner *' with an rvalue of type > 'base::SequencedTaskRunner *' > scoped_refptr(scoped_refptr<U>&& r) : ptr_(r.get()) { > ^ ~~~~~~~ > ../../components/gcm_driver/gcm_profile_service_unittest.cc:140:44: note: in > instantiation of function template specialization > 'scoped_refptr<base::SingleThreadTaskRunner>::scoped_refptr<base::SequencedTaskRunner>' > requested here > new > net::TestURLRequestContextGetter(scoped_refptr<base::SequencedTaskRunner> > (task_runner)); If you change task_runner to be a scoped_refptr<base::SingleThreadTaskRunner> that should work, no? scoped_refptr<base::SingleThreadTaskRunner> task_runner = message_loop_.task_runner();
https://codereview.chromium.org/1464463004/diff/120001/components/gcm_driver/... File components/gcm_driver/gcm_profile_service_unittest.cc (right): https://codereview.chromium.org/1464463004/diff/120001/components/gcm_driver/... components/gcm_driver/gcm_profile_service_unittest.cc:139: new net::TestURLRequestContextGetter(message_loop_.task_runner()); On 2015/12/15 14:51:12, droger wrote: > On 2015/12/15 07:59:49, Jitu( very slow this week) wrote: > > Converting to SingleThreadTaskRunner here gives me below error. > > Please let me know in case any thing wrong here. > > > > net::URLRequestContextGetter* request_context = > > new > > net::TestURLRequestContextGetter(scoped_refptr<base::SingleThreadTaskRunner> > > (task_runner)); > > > > Error below :: > > ============== > > > > ../../base/memory/ref_counted.h:292:41: error: cannot initialize a member > > subobject of type 'base::SingleThreadTaskRunner *' with an rvalue of type > > 'base::SequencedTaskRunner *' > > scoped_refptr(scoped_refptr<U>&& r) : ptr_(r.get()) { > > ^ ~~~~~~~ > > ../../components/gcm_driver/gcm_profile_service_unittest.cc:140:44: note: in > > instantiation of function template specialization > > > 'scoped_refptr<base::SingleThreadTaskRunner>::scoped_refptr<base::SequencedTaskRunner>' > > requested here > > new > > net::TestURLRequestContextGetter(scoped_refptr<base::SequencedTaskRunner> > > (task_runner)); > > If you change task_runner to be a scoped_refptr<base::SingleThreadTaskRunner> > that should work, no? > > scoped_refptr<base::SingleThreadTaskRunner> task_runner = > message_loop_.task_runner(); It will work here, but it will fail for the last argument in GCMProfileService() as it needs type scoped_refptr<base::SequencedTaskRunner>. base::SequencedTaskRunner is the base class for base::SingleThreadTaskRunner.
https://codereview.chromium.org/1464463004/diff/120001/components/gcm_driver/... File components/gcm_driver/gcm_profile_service_unittest.cc (right): https://codereview.chromium.org/1464463004/diff/120001/components/gcm_driver/... components/gcm_driver/gcm_profile_service_unittest.cc:139: new net::TestURLRequestContextGetter(message_loop_.task_runner()); On 2015/12/16 05:41:09, Jitu( very slow this week) wrote: > On 2015/12/15 14:51:12, droger wrote: > > On 2015/12/15 07:59:49, Jitu( very slow this week) wrote: > > > Converting to SingleThreadTaskRunner here gives me below error. > > > Please let me know in case any thing wrong here. > > > > > > net::URLRequestContextGetter* request_context = > > > new > > > net::TestURLRequestContextGetter(scoped_refptr<base::SingleThreadTaskRunner> > > > (task_runner)); > > > > > > Error below :: > > > ============== > > > > > > ../../base/memory/ref_counted.h:292:41: error: cannot initialize a member > > > subobject of type 'base::SingleThreadTaskRunner *' with an rvalue of type > > > 'base::SequencedTaskRunner *' > > > scoped_refptr(scoped_refptr<U>&& r) : ptr_(r.get()) { > > > ^ ~~~~~~~ > > > ../../components/gcm_driver/gcm_profile_service_unittest.cc:140:44: note: in > > > instantiation of function template specialization > > > > > > 'scoped_refptr<base::SingleThreadTaskRunner>::scoped_refptr<base::SequencedTaskRunner>' > > > requested here > > > new > > > net::TestURLRequestContextGetter(scoped_refptr<base::SequencedTaskRunner> > > > (task_runner)); > > > > If you change task_runner to be a scoped_refptr<base::SingleThreadTaskRunner> > > that should work, no? > > > > scoped_refptr<base::SingleThreadTaskRunner> task_runner = > > message_loop_.task_runner(); > > It will work here, but it will fail for the last argument in GCMProfileService() > as it needs type scoped_refptr<base::SequencedTaskRunner>. > > base::SequencedTaskRunner is the base class for base::SingleThreadTaskRunner. I patched your CL and changed |task_runner| to be SingleThreadTaskRunner. I indeed saw a compile error for the last argument of GCMProfileService(). This error can be fixed by changing the GCMProfileService constructor to take a const scoped_refptr<base::SequencedTaskRunner>& instead of scoped_refptr<base::SequencedTaskRunner>& (there was a missing const).
PTAL ! https://codereview.chromium.org/1464463004/diff/120001/components/gcm_driver/... File components/gcm_driver/gcm_profile_service_unittest.cc (right): https://codereview.chromium.org/1464463004/diff/120001/components/gcm_driver/... components/gcm_driver/gcm_profile_service_unittest.cc:139: new net::TestURLRequestContextGetter(message_loop_.task_runner()); On 2015/12/17 10:18:24, droger wrote: > On 2015/12/16 05:41:09, Jitu( very slow this week) wrote: > > On 2015/12/15 14:51:12, droger wrote: > > > On 2015/12/15 07:59:49, Jitu( very slow this week) wrote: > > > > Converting to SingleThreadTaskRunner here gives me below error. > > > > Please let me know in case any thing wrong here. > > > > > > > > net::URLRequestContextGetter* request_context = > > > > new > > > > > net::TestURLRequestContextGetter(scoped_refptr<base::SingleThreadTaskRunner> > > > > (task_runner)); > > > > > > > > Error below :: > > > > ============== > > > > > > > > ../../base/memory/ref_counted.h:292:41: error: cannot initialize a member > > > > subobject of type 'base::SingleThreadTaskRunner *' with an rvalue of type > > > > 'base::SequencedTaskRunner *' > > > > scoped_refptr(scoped_refptr<U>&& r) : ptr_(r.get()) { > > > > ^ ~~~~~~~ > > > > ../../components/gcm_driver/gcm_profile_service_unittest.cc:140:44: note: > in > > > > instantiation of function template specialization > > > > > > > > > > 'scoped_refptr<base::SingleThreadTaskRunner>::scoped_refptr<base::SequencedTaskRunner>' > > > > requested here > > > > new > > > > net::TestURLRequestContextGetter(scoped_refptr<base::SequencedTaskRunner> > > > > (task_runner)); > > > > > > If you change task_runner to be a > scoped_refptr<base::SingleThreadTaskRunner> > > > that should work, no? > > > > > > scoped_refptr<base::SingleThreadTaskRunner> task_runner = > > > message_loop_.task_runner(); > > > > It will work here, but it will fail for the last argument in > GCMProfileService() > > as it needs type scoped_refptr<base::SequencedTaskRunner>. > > > > base::SequencedTaskRunner is the base class for base::SingleThreadTaskRunner. > > I patched your CL and changed |task_runner| to be SingleThreadTaskRunner. > I indeed saw a compile error for the last argument of GCMProfileService(). > > This error can be fixed by changing the GCMProfileService constructor to take a > const scoped_refptr<base::SequencedTaskRunner>& > instead of > scoped_refptr<base::SequencedTaskRunner>& > > (there was a missing const). Thanks a lot
LGTM, thanks. I suggest adding zea as OWNER once you addressed the comments below. https://codereview.chromium.org/1464463004/diff/140001/components/gcm_driver/... File components/gcm_driver/gcm_profile_service_unittest.cc (right): https://codereview.chromium.org/1464463004/diff/140001/components/gcm_driver/... components/gcm_driver/gcm_profile_service_unittest.cc:118: AccountTrackerService::MIGRATION_NOT_STARTED); These prefs may no longer be necessary, please check. https://codereview.chromium.org/1464463004/diff/140001/components/gcm_driver/... components/gcm_driver/gcm_profile_service_unittest.cc:138: net::URLRequestContextGetter* request_context = Nit: it would be more correct to use a scoped_refptr here, to ensure that it does not leak. scoped_refptr<net::URLRequestContextGetter> request_context =
jitendra.ks@samsung.com changed reviewers: + zea@chromium.org
@Zea, PTAL ! https://codereview.chromium.org/1464463004/diff/140001/components/gcm_driver/... File components/gcm_driver/gcm_profile_service_unittest.cc (right): https://codereview.chromium.org/1464463004/diff/140001/components/gcm_driver/... components/gcm_driver/gcm_profile_service_unittest.cc:118: AccountTrackerService::MIGRATION_NOT_STARTED); On 2015/12/17 13:23:22, droger wrote: > These prefs may no longer be necessary, please check. Done. https://codereview.chromium.org/1464463004/diff/140001/components/gcm_driver/... components/gcm_driver/gcm_profile_service_unittest.cc:138: net::URLRequestContextGetter* request_context = On 2015/12/17 13:23:22, droger wrote: > Nit: > it would be more correct to use a scoped_refptr here, to ensure that it does not > leak. > > scoped_refptr<net::URLRequestContextGetter> request_context = Done.
lgtm
The CQ bit was checked by jitendra.ks@samsung.com
The patchset sent to the CQ was uploaded after l-g-t-m from droger@chromium.org Link to the patchset: https://codereview.chromium.org/1464463004/#ps160001 (title: "Fix comments")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1464463004/160001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1464463004/160001
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: linux_chromium_compile_dbg_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...) linux_chromium_gn_chromeos_rel on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...) mac_chromium_gn_rel on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_gn_r...)
On 2015/12/18 05:25:28, commit-bot: I haz the power wrote: > Try jobs failed on following builders: > linux_chromium_compile_dbg_ng on tryserver.chromium.linux (JOB_FAILED, > http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...) > linux_chromium_gn_chromeos_rel on tryserver.chromium.linux (JOB_FAILED, > http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...) > mac_chromium_gn_rel on tryserver.chromium.mac (JOB_FAILED, > http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_gn_r...) @Droger, It is failing in DCHECK() in some buildbots. Below is the error, [14986:1803:1218/045513:16431517376621:FATAL:signin_manager_base.cc(35)] Check failed: client_. As we passes the null client, it fails here. So do we need to create a valid signinclient, AccountTrackerService and set it up. Or any other way , please suggest me.
Patchset #9 (id:220001) has been deleted
droger@chromium.org changed reviewers: - droger@chromium.org |