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

Issue 803873004: ContentBrowserSanityChecker (Closed)

Created:
6 years ago by ncarter (slow)
Modified:
5 years, 7 months ago
CC:
chromium-reviews, creis+watch_chromium.org, darin-cc_chromium.org, nasko+codewatch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Introduce ContentBrowserSanityChecker, which currently just adds checks to validate the sanity of the WebContentsObserver invocations, but which hopefully will grow to include other too-heavy-for-production-code bug detection logic. The currently supported check, WebContentsObserverSanityChecker, is a fleshed- out version of the FrameLifetimeConsistencyChecker previously used in RenderFrameHost unittests. This sanity check managed to identify the root cause for bug 438951, so it's already proved itself useful. Enabling it on all tests should prevent future regressions of that kind. To install this on all WebContentses, we need to un-deprecate the WebContentsImpl::AddCreatedCallback/RemoveCreatedCallback mechanism. To make that safer, the dangerous methods are moved to the FriendZone (get it?) which is what I call what Dr. Dobbs calls, stodgily, the "C++ attorney/client idiom" http://goo.gl/13oS7e. They also now have, cleverly, ForTesting in their names. Lastly, we change the invocation time of the g_created_callbacks to be at the end of WebContents::Init, instead of at the end of the ctor, so we're not inviting tests to muck around with a half-inflated WebContents. BUG=438951, 444722, 444717 TBR=jochen@chromium.org Committed: https://crrev.com/f9acfbeeed26e7cd71b4fd0d7fa1754dd80140d5 Cr-Commit-Position: refs/heads/master@{#309571}

Patch Set 1 #

Patch Set 2 : Productionize the consistency checker, install it everywhere. #

Patch Set 3 : Self-review fixes #

Patch Set 4 : Newlines at eof, apparently #

Patch Set 5 : Move controversial methods to the FriendZone #

Patch Set 6 : Jiggle the comments. #

Total comments: 2

Patch Set 7 : Disable a test, take Avi's fixes. #

Patch Set 8 : Add a link to bug 444722 #

Patch Set 9 : Add semicolon. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+470 lines, -80 lines) Patch
M chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc View 1 2 3 4 5 6 1 chunk +2 lines, -1 line 0 comments Download
M content/browser/frame_host/frame_tree_unittest.cc View 1 2 3 4 5 6 7 1 chunk +7 lines, -1 line 0 comments Download
M content/browser/frame_host/render_frame_host_manager_unittest.cc View 1 2 2 chunks +1 line, -60 lines 0 comments Download
M content/browser/web_contents/web_contents_impl.h View 1 2 3 4 5 4 chunks +19 lines, -7 lines 0 comments Download
M content/browser/web_contents/web_contents_impl.cc View 1 2 3 4 3 chunks +7 lines, -4 lines 0 comments Download
M content/content_tests.gypi View 1 2 3 4 2 chunks +5 lines, -1 line 0 comments Download
M content/public/test/browser_test_base.cc View 1 2 3 4 2 chunks +5 lines, -1 line 0 comments Download
A content/public/test/content_browser_sanity_checker.h View 1 2 3 4 1 chunk +42 lines, -0 lines 0 comments Download
A content/public/test/content_browser_sanity_checker.cc View 1 2 3 4 5 6 7 8 1 chunk +39 lines, -0 lines 0 comments Download
M content/public/test/content_browser_test_utils.cc View 1 2 3 4 1 chunk +4 lines, -2 lines 0 comments Download
M content/public/test/test_navigation_observer.cc View 1 2 3 4 1 chunk +4 lines, -2 lines 0 comments Download
M content/public/test/test_renderer_host.h View 1 2 3 4 2 chunks +3 lines, -0 lines 0 comments Download
M content/public/test/test_renderer_host.cc View 1 2 3 4 5 3 chunks +4 lines, -1 line 0 comments Download
A content/public/test/web_contents_observer_sanity_checker.h View 1 2 3 4 5 1 chunk +99 lines, -0 lines 0 comments Download
A content/public/test/web_contents_observer_sanity_checker.cc View 1 2 3 4 1 chunk +229 lines, -0 lines 0 comments Download

Messages

Total messages: 25 (9 generated)
Avi (use Gerrit)
I personally think this is a great idea. My recommendations: - Land the fix as ...
6 years ago (2014-12-19 19:29:53 UTC) #2
ncarter (slow)
Avi, please have a look. I think I've implemented all your suggestions.
5 years, 12 months ago (2014-12-22 19:32:56 UTC) #3
Avi (use Gerrit)
Whoa. I really like this. LGTM https://codereview.chromium.org/803873004/diff/100001/content/public/test/content_browser_sanity_checker.cc File content/public/test/content_browser_sanity_checker.cc (right): https://codereview.chromium.org/803873004/diff/100001/content/public/test/content_browser_sanity_checker.cc#newcode19 content/public/test/content_browser_sanity_checker.cc:19: << "There's no ...
5 years, 12 months ago (2014-12-22 22:53:50 UTC) #4
ncarter (slow)
I've fixed Avi's suggestion, disabled a test in web_navigation_apitest, and added links to two bugs ...
5 years, 12 months ago (2014-12-23 00:17:04 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/803873004/140001
5 years, 12 months ago (2014-12-23 00:18:03 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/803873004/160001
5 years, 12 months ago (2014-12-23 00:29:06 UTC) #11
commit-bot: I haz the power
Try jobs failed on following builders: android_dbg_tests_recipe on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_dbg_tests_recipe/builds/40187)
5 years, 12 months ago (2014-12-23 02:09:41 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/803873004/160001
5 years, 12 months ago (2014-12-23 06:52:37 UTC) #15
commit-bot: I haz the power
Try jobs failed on following builders: android_dbg_tests_recipe on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_dbg_tests_recipe/builds/40240)
5 years, 12 months ago (2014-12-23 08:35:00 UTC) #17
jochen (gone - plz use gerrit)
btw, as I stated on the bug, I think the WebNavigationTest catches a real failure. ...
5 years, 12 months ago (2014-12-23 14:01:42 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/803873004/160001
5 years, 12 months ago (2014-12-23 19:11:50 UTC) #20
commit-bot: I haz the power
Committed patchset #9 (id:160001)
5 years, 12 months ago (2014-12-23 19:13:07 UTC) #21
commit-bot: I haz the power
Patchset 9 (id:??) landed as https://crrev.com/f9acfbeeed26e7cd71b4fd0d7fa1754dd80140d5 Cr-Commit-Position: refs/heads/master@{#309571}
5 years, 12 months ago (2014-12-23 19:14:18 UTC) #22
jam
I just saw these test files. They're only used by content, so they should be ...
5 years, 7 months ago (2015-05-11 14:44:24 UTC) #23
ncarter (slow)
On 2015/05/11 14:44:24, jam wrote: > I just saw these test files. They're only used ...
5 years, 7 months ago (2015-05-13 17:39:48 UTC) #24
jam
5 years, 7 months ago (2015-05-13 17:47:18 UTC) #25
Message was sent while issue was closed.
great, thanks

On Wed, May 13, 2015 at 10:39 AM, <nick@chromium.org> wrote:

> On 2015/05/11 14:44:24, jam wrote:
>
>> I just saw these test files. They're only used by content, so they should
>> be
>>
> in
>
>> content/test instead of content/public/test
>>
>
> Thanks John and good catch.
>
> fwiw -- I put them in public, expecting to need to instantiate and/or
> configure
> them from chrome browsertests. But instantiation for chrome browser_tests
> is
> done for free by hooking BrowserTestBase, and the need for configuration
> (e.g.,
> to disable an invariant check for the purposes of testing) hasn't
> materialized
> yet.
>
> I'll send you a CL. If we do need to expose them for configuration by
> chrome
> tests, we can expose narrow methods for that purpose alone.
>
>
> https://codereview.chromium.org/803873004/
>

To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698