Content settings: remove some plugin-related code/resources when... there are no...
[chromium-blink-merge.git] / content / test / content_browser_sanity_checker.h
blobc63f627986b0749442942f9b90bea6179d9bd669
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_TEST_CONTENT_BROWSER_SANITY_CHECKER_H_
6 #define CONTENT_TEST_CONTENT_BROWSER_SANITY_CHECKER_H_
8 #include "base/basictypes.h"
9 #include "base/callback.h"
11 namespace content {
13 class WebContents;
15 // While an instance of this class exists, a bunch of sanity-checks are enabled
16 // to validate the correctness of the browser side of the content layer
17 // implementation. It's good to enable these in both unit tests and browser
18 // tests, as a means of detecting bugs in the implementation of the content api.
20 // These checks should typically be enabled by the base class of any test
21 // framework that would instantiate a WebContents -- ContentBrowserTest::SetUp,
22 // RenderViewHostTestHarness::SetUp, and so forth. Individual tests won't
23 // typically need to enable them.
25 // For the nuts and bolts of what the checks enforce, see the implementation.
26 class ContentBrowserSanityChecker {
27 public:
28 ContentBrowserSanityChecker();
29 ~ContentBrowserSanityChecker();
31 private:
32 void OnWebContentsCreated(WebContents* web_contents);
34 // The callback needs to be cached so that it can be unregistered.
35 base::Callback<void(WebContents*)> creation_hook_;
37 DISALLOW_COPY_AND_ASSIGN(ContentBrowserSanityChecker);
40 } // namespace content
42 #endif // CONTENT_TEST_CONTENT_BROWSER_SANITY_CHECKER_H_