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

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

Issue 2489673005: [headless] Make browser service manifest overlay configurable. (Closed)
Patch Set: fix includes. Created 4 years, 1 month 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 #include "base/optional.h" 6 #include "base/optional.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/strings/string_piece.h"
8 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
9 #include "base/threading/thread_restrictions.h" 10 #include "base/threading/thread_restrictions.h"
10 #include "content/public/test/browser_test.h" 11 #include "content/public/test/browser_test.h"
11 #include "headless/grit/headless_browsertest_resources.h" 12 #include "headless/grit/headless_browsertest_resources.h"
12 #include "headless/lib/embedder_test.mojom.h" 13 #include "headless/lib/embedder_test.mojom.h"
13 #include "headless/public/devtools/domains/network.h" 14 #include "headless/public/devtools/domains/network.h"
14 #include "headless/public/devtools/domains/page.h" 15 #include "headless/public/devtools/domains/page.h"
15 #include "headless/public/devtools/domains/runtime.h" 16 #include "headless/public/devtools/domains/runtime.h"
16 #include "headless/public/headless_browser.h" 17 #include "headless/public/headless_browser.h"
17 #include "headless/public/headless_devtools_client.h" 18 #include "headless/public/headless_devtools_client.h"
(...skipping 24 matching lines...) Expand all
42 EmbedderMojoTest() : EmbedderMojoTest(HttpPolicy::DEFAULT) {} 43 EmbedderMojoTest() : EmbedderMojoTest(HttpPolicy::DEFAULT) {}
43 44
44 explicit EmbedderMojoTest(HttpPolicy http_policy) 45 explicit EmbedderMojoTest(HttpPolicy http_policy)
45 : browser_context_(nullptr), 46 : browser_context_(nullptr),
46 web_contents_(nullptr), 47 web_contents_(nullptr),
47 devtools_client_(HeadlessDevToolsClient::Create()), 48 devtools_client_(HeadlessDevToolsClient::Create()),
48 http_policy_(http_policy) {} 49 http_policy_(http_policy) {}
49 50
50 ~EmbedderMojoTest() override {} 51 ~EmbedderMojoTest() override {}
51 52
53 void SetUp() override {
54 // Set service names before they are used during main thread initialization.
55 options()->mojo_service_names.insert("embedder_test::TestEmbedderService");
56
57 HeadlessBrowserTest::SetUp();
58 }
59
52 void SetUpOnMainThread() override { 60 void SetUpOnMainThread() override {
53 base::ThreadRestrictions::SetIOAllowed(true); 61 base::ThreadRestrictions::SetIOAllowed(true);
54 base::FilePath pak_path; 62 base::FilePath pak_path;
55 ASSERT_TRUE(PathService::Get(base::DIR_MODULE, &pak_path)); 63 ASSERT_TRUE(PathService::Get(base::DIR_MODULE, &pak_path));
56 pak_path = pak_path.AppendASCII("headless_browser_tests.pak"); 64 pak_path = pak_path.AppendASCII("headless_browser_tests.pak");
57 ResourceBundle::GetSharedInstance().AddDataPackFromPath( 65 ResourceBundle::GetSharedInstance().AddDataPackFromPath(
58 pak_path, ui::SCALE_FACTOR_NONE); 66 pak_path, ui::SCALE_FACTOR_NONE);
59 } 67 }
60 68
61 // HeadlessWebContentsObserver implementation: 69 // HeadlessWebContentsObserver implementation:
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 void OnLoadingFailed(const network::LoadingFailedParams& params) override { 246 void OnLoadingFailed(const network::LoadingFailedParams& params) override {
239 // The navigation should fail since HTTP requests are blackholed. 247 // The navigation should fail since HTTP requests are blackholed.
240 EXPECT_EQ(params.GetErrorText(), "net::ERR_FILE_NOT_FOUND"); 248 EXPECT_EQ(params.GetErrorText(), "net::ERR_FILE_NOT_FOUND");
241 FinishAsynchronousTest(); 249 FinishAsynchronousTest();
242 } 250 }
243 }; 251 };
244 252
245 DEVTOOLS_CLIENT_TEST_F(HttpDisabledByDefaultWhenMojoBindingsUsed); 253 DEVTOOLS_CLIENT_TEST_F(HttpDisabledByDefaultWhenMojoBindingsUsed);
246 254
247 } // namespace headless 255 } // namespace headless
OLDNEW
« no previous file with comments | « headless/lib/browser/headless_content_browser_client.cc ('k') | headless/lib/resources/headless_lib_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698