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

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

Issue 2489673005: [headless] Make browser service manifest overlay configurable. (Closed)
Patch Set: v1 load from resource id provided in options. 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 the manifest overlay before it is requested during main thread
55 // initialization.
56 options()->mojo_service_manifest_resource_id =
57 IDR_HEADLESS_EMBEDDER_TEST_MANIFEST_OVERLAY_JSON;
58
59 HeadlessBrowserTest::SetUp();
60 }
61
52 void SetUpOnMainThread() override { 62 void SetUpOnMainThread() override {
53 base::ThreadRestrictions::SetIOAllowed(true); 63 base::ThreadRestrictions::SetIOAllowed(true);
54 base::FilePath pak_path; 64 base::FilePath pak_path;
55 ASSERT_TRUE(PathService::Get(base::DIR_MODULE, &pak_path)); 65 ASSERT_TRUE(PathService::Get(base::DIR_MODULE, &pak_path));
56 pak_path = pak_path.AppendASCII("headless_browser_tests.pak"); 66 pak_path = pak_path.AppendASCII("headless_browser_tests.pak");
57 ResourceBundle::GetSharedInstance().AddDataPackFromPath( 67 ResourceBundle::GetSharedInstance().AddDataPackFromPath(
58 pak_path, ui::SCALE_FACTOR_NONE); 68 pak_path, ui::SCALE_FACTOR_NONE);
59 } 69 }
60 70
61 // HeadlessWebContentsObserver implementation: 71 // HeadlessWebContentsObserver implementation:
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 void OnLoadingFailed(const network::LoadingFailedParams& params) override { 248 void OnLoadingFailed(const network::LoadingFailedParams& params) override {
239 // The navigation should fail since HTTP requests are blackholed. 249 // The navigation should fail since HTTP requests are blackholed.
240 EXPECT_EQ(params.GetErrorText(), "net::ERR_FILE_NOT_FOUND"); 250 EXPECT_EQ(params.GetErrorText(), "net::ERR_FILE_NOT_FOUND");
241 FinishAsynchronousTest(); 251 FinishAsynchronousTest();
242 } 252 }
243 }; 253 };
244 254
245 DEVTOOLS_CLIENT_TEST_F(HttpDisabledByDefaultWhenMojoBindingsUsed); 255 DEVTOOLS_CLIENT_TEST_F(HttpDisabledByDefaultWhenMojoBindingsUsed);
246 256
247 } // namespace headless 257 } // namespace headless
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698