New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 647222 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Sep 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Bug

Blocking:
issue 646759



Sign in to add a comment

BrowsingDataRemover creates ContentSuggestionService irrespective of platform / feature.

Project Member Reported by jkrcal@chromium.org, Sep 15 2016

Issue description

The BrowsingDataRemover class accesses ClearHistory() of ContentSuggestionService to clear the history of the service. This happens even in situation when this service was not previously instantiated such as on non-android platforms.

The fix: access the service only if it has been created previously. This way, we fully respect (and not duplicate) the logic of when to create the service.
 

Comment 1 by jkrcal@chromium.org, Sep 15 2016

Blocking: 646759
This bug blocks bug 646759. 

That bug asks for setting snippets to be enabled for non signed-in users by default. As a result the ContentSuggestionService is enabled in all unit-tests indirectly calling BrowsingDataRemover::RemoveImpl(). Because the service is enabled, some of its (un-mocked) providers get created, initiating some I/O operations that are illegal in unit-tests.

Comment 2 by bauerb@chromium.org, Sep 15 2016

For posteriority, here's a full stack trace for the failing test (from https://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/297445/steps/unit_tests%20%28with%20patch%29%20on%20Ubuntu-12.04/logs/stdio):

[2757:2757:0914/053455:9879915294:FATAL:message_loop.h(675)] Check failed: MessageLoop::TYPE_IO == loop->type() (3 vs. 1)
#0 0x000003f6cb8e base::debug::StackTrace::StackTrace()
#1 0x000003f83f5b logging::LogMessage::~LogMessage()
#2 0x000001e05b12 base::MessageLoopForIO::current()
#3 0x000003505d77 net::SocketPosix::Connect()
#4 0x00000342b274 net::TCPSocketPosix::Connect()
#5 0x000003429667 net::TCPClientSocket::DoConnect()
#6 0x000003429337 net::TCPClientSocket::DoConnectLoop()
#7 0x0000034291ce net::TCPClientSocket::Connect()
#8 0x00000342e0aa net::TransportConnectJob::DoTransportConnect()
#9 0x00000342daa7 net::TransportConnectJob::DoLoop()
#10 0x00000342d8b9 net::TransportConnectJob::OnIOComplete()
#11 0x00000354616f net::MockHostResolverBase::RequestImpl::OnResolveCompleted()
#12 0x000003545c12 net::MockHostResolverBase::ResolveNow()
#13 0x000004000ea4 base::debug::TaskAnnotator::RunTask()
#14 0x000003f8bb65 base::MessageLoop::RunTask()
#15 0x000003f8bea8 base::MessageLoop::DeferOrRunPendingTask()
#16 0x000003f8c1eb base::MessageLoop::DoWork()
#17 0x000003f8dbf9 base::MessagePumpGlib::Run()
#18 0x000003f8b661 base::MessageLoop::RunHandler()
#19 0x000003facab0 base::RunLoop::Run()
#20 0x0000032c8140 content::RunThisRunLoop()
#21 0x0000032c876c content::MessageLoopRunner::Run()
#22 0x0000006a7c02 BrowsingDataRemoverTest::BlockUntilBrowsingDataRemoved()
#23 0x0000006b20f8 BrowsingDataRemoverTest_RemoveFaviconsForever_Test::TestBody()
#24 0x000003583857 testing::Test::Run()
#25 0x000003584513 testing::TestInfo::Run()
#26 0x0000035849a7 testing::TestCase::Run()
#27 0x00000358b9e7 testing::internal::UnitTestImpl::RunAllTests()
#28 0x00000358b63a testing::UnitTest::Run()
#29 0x00000328d273 base::TestSuite::Run()
#30 0x00000328ece9 base::(anonymous namespace)::LaunchUnitTestsInternal()
#31 0x00000328ebb4 base::LaunchUnitTests()
#32 0x000003288f68 main
#33 0x7f5c88cdd7ed __libc_start_main
#34 0x0000006191a1 <unknown>

Project Member

Comment 3 by bugdroid1@chromium.org, Sep 16 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/9d1e504520b774c0a6f24920f730748053c4b2b2

commit 9d1e504520b774c0a6f24920f730748053c4b2b2
Author: jkrcal <jkrcal@chromium.org>
Date: Fri Sep 16 11:02:02 2016

Clear browsing data from ContentSuggestionService only if exists.

Currently, we instantiate the service in BrowsingDataRemover even when
it does not exist, yet. This means that we instantiate it on non-android
platforms, in unit-tests, etc.

This CL changes the logic so that the service is accessed only if it has
been created previously. This way, the BrowsingDataRemover respects the
start-up logic that decides whether to create the service or not.

BUG= 647222 

Review-Url: https://codereview.chromium.org/2342673004
Cr-Commit-Position: refs/heads/master@{#419141}

[modify] https://crrev.com/9d1e504520b774c0a6f24920f730748053c4b2b2/chrome/browser/browsing_data/browsing_data_remover.cc
[modify] https://crrev.com/9d1e504520b774c0a6f24920f730748053c4b2b2/chrome/browser/ntp_snippets/content_suggestions_service_factory.cc
[modify] https://crrev.com/9d1e504520b774c0a6f24920f730748053c4b2b2/chrome/browser/ntp_snippets/content_suggestions_service_factory.h
[modify] https://crrev.com/9d1e504520b774c0a6f24920f730748053c4b2b2/components/ntp_snippets/ntp_snippets_service.cc

Comment 4 by fi...@chromium.org, Sep 19 2016

Labels: zine-client-v1 zine-triaged

Comment 5 by jkrcal@chromium.org, Sep 19 2016

Status: Fixed (was: Assigned)

Sign in to add a comment