1 // Copyright (c) 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. 4 5 #ifndef CONTENT_BROWSER_SITE_PER_PROCESS_BROWSERTEST_H_ 6 #define CONTENT_BROWSER_SITE_PER_PROCESS_BROWSERTEST_H_ 7 8 #include <string> 9 10 #include "base/macros.h" 11 #include "base/test/scoped_feature_list.h" 12 #include "content/browser/web_contents/web_contents_impl.h" 13 #include "content/public/test/content_browser_test.h" 14 #include "content/shell/browser/shell.h" 15 #include "content/test/content_browser_test_utils_internal.h" 16 #include "url/gurl.h" 17 18 namespace content { 19 20 class FrameTreeNode; 21 22 class SitePerProcessBrowserTestBase : public ContentBrowserTest { 23 public: 24 SitePerProcessBrowserTestBase(); 25 26 protected: 27 std::string DepictFrameTree(FrameTreeNode* node); 28 29 void SetUpCommandLine(base::CommandLine* command_line) override; 30 void SetUpOnMainThread() override; 31 web_contents()32 WebContentsImpl* web_contents() const { 33 return static_cast<WebContentsImpl*>(shell()->web_contents()); 34 } 35 36 private: 37 FrameTreeVisualizer visualizer_; 38 base::test::ScopedFeatureList feature_list_; 39 40 DISALLOW_COPY_AND_ASSIGN(SitePerProcessBrowserTestBase); 41 }; 42 43 class SitePerProcessBrowserTest 44 : public SitePerProcessBrowserTestBase, 45 public ::testing::WithParamInterface<std::string> { 46 public: 47 SitePerProcessBrowserTest(); 48 49 private: 50 base::test::ScopedFeatureList feature_list_; 51 52 DISALLOW_COPY_AND_ASSIGN(SitePerProcessBrowserTest); 53 }; 54 55 } // namespace content 56 57 #endif // CONTENT_BROWSER_SITE_PER_PROCESS_BROWSERTEST_H_ 58