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

Side by Side Diff: headless/lib/headless_devtools_client_browsertest.cc

Issue 2043603004: headless: Introduce a browser context (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <memory> 5 #include <memory>
6 6
7 #include "content/public/test/browser_test.h" 7 #include "content/public/test/browser_test.h"
8 #include "headless/public/domains/network.h" 8 #include "headless/public/domains/network.h"
9 #include "headless/public/domains/page.h" 9 #include "headless/public/domains/page.h"
10 #include "headless/public/domains/runtime.h" 10 #include "headless/public/domains/runtime.h"
(...skipping 26 matching lines...) Expand all
37 void DevToolsTargetReady() override { 37 void DevToolsTargetReady() override {
38 EXPECT_TRUE(web_contents_->GetDevToolsTarget()); 38 EXPECT_TRUE(web_contents_->GetDevToolsTarget());
39 web_contents_->GetDevToolsTarget()->AttachClient(devtools_client_.get()); 39 web_contents_->GetDevToolsTarget()->AttachClient(devtools_client_.get());
40 RunDevToolsClientTest(); 40 RunDevToolsClientTest();
41 } 41 }
42 42
43 virtual void RunDevToolsClientTest() = 0; 43 virtual void RunDevToolsClientTest() = 0;
44 44
45 protected: 45 protected:
46 void RunTest() { 46 void RunTest() {
47 web_contents_ = 47 web_contents_ = browser()->CreateWebContentsBuilder().Build();
48 browser()->CreateWebContents(GURL("about:blank"), gfx::Size(800, 600));
49 web_contents_->AddObserver(this); 48 web_contents_->AddObserver(this);
50 49
51 RunAsynchronousTest(); 50 RunAsynchronousTest();
52 51
53 web_contents_->GetDevToolsTarget()->DetachClient(devtools_client_.get()); 52 web_contents_->GetDevToolsTarget()->DetachClient(devtools_client_.get());
54 web_contents_->RemoveObserver(this); 53 web_contents_->RemoveObserver(this);
55 web_contents_->Close(); 54 web_contents_->Close();
56 web_contents_ = nullptr; 55 web_contents_ = nullptr;
57 } 56 }
58 57
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 205
207 void OnFrameStoppedLoading( 206 void OnFrameStoppedLoading(
208 const page::FrameStoppedLoadingParams& params) override { 207 const page::FrameStoppedLoadingParams& params) override {
209 FinishAsynchronousTest(); 208 FinishAsynchronousTest();
210 } 209 }
211 }; 210 };
212 211
213 DEVTOOLS_CLIENT_TEST_F(HeadlessDevToolsClientExperimentalTest); 212 DEVTOOLS_CLIENT_TEST_F(HeadlessDevToolsClientExperimentalTest);
214 213
215 } // namespace headless 214 } // namespace headless
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698