| OLD | NEW |
| 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 "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 std::unique_ptr<HeadlessDevToolsClient> devtools_client2_; | 153 std::unique_ptr<HeadlessDevToolsClient> devtools_client2_; |
| 154 std::unique_ptr<LoadObserver> load_observer_; | 154 std::unique_ptr<LoadObserver> load_observer_; |
| 155 }; | 155 }; |
| 156 | 156 |
| 157 HEADLESS_ASYNC_DEVTOOLED_TEST_F(HeadlessBrowserContextIsolationTest); | 157 HEADLESS_ASYNC_DEVTOOLED_TEST_F(HeadlessBrowserContextIsolationTest); |
| 158 | 158 |
| 159 IN_PROC_BROWSER_TEST_F(HeadlessBrowserTest, ContextProtocolHandler) { | 159 IN_PROC_BROWSER_TEST_F(HeadlessBrowserTest, ContextProtocolHandler) { |
| 160 const std::string kResponseBody = "<p>HTTP response body</p>"; | 160 const std::string kResponseBody = "<p>HTTP response body</p>"; |
| 161 ProtocolHandlerMap protocol_handlers; | 161 ProtocolHandlerMap protocol_handlers; |
| 162 protocol_handlers[url::kHttpScheme] = | 162 protocol_handlers[url::kHttpScheme] = |
| 163 base::WrapUnique(new TestProtocolHandler(kResponseBody)); | 163 base::MakeUnique<TestProtocolHandler>(kResponseBody); |
| 164 | 164 |
| 165 // Load a page which doesn't actually exist, but which is fetched by our | 165 // Load a page which doesn't actually exist, but which is fetched by our |
| 166 // custom protocol handler. | 166 // custom protocol handler. |
| 167 HeadlessBrowserContext* browser_context = | 167 HeadlessBrowserContext* browser_context = |
| 168 browser() | 168 browser() |
| 169 ->CreateBrowserContextBuilder() | 169 ->CreateBrowserContextBuilder() |
| 170 .SetProtocolHandlers(std::move(protocol_handlers)) | 170 .SetProtocolHandlers(std::move(protocol_handlers)) |
| 171 .Build(); | 171 .Build(); |
| 172 HeadlessWebContents* web_contents = | 172 HeadlessWebContents* web_contents = |
| 173 browser_context->CreateWebContentsBuilder() | 173 browser_context->CreateWebContentsBuilder() |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 .Build(); | 261 .Build(); |
| 262 | 262 |
| 263 EXPECT_TRUE(WaitForLoad(web_contents)); | 263 EXPECT_TRUE(WaitForLoad(web_contents)); |
| 264 | 264 |
| 265 // Similar to test above, but now we are in incognito mode, | 265 // Similar to test above, but now we are in incognito mode, |
| 266 // so nothing should be written to this directory. | 266 // so nothing should be written to this directory. |
| 267 EXPECT_TRUE(base::IsDirectoryEmpty(user_data_dir.path())); | 267 EXPECT_TRUE(base::IsDirectoryEmpty(user_data_dir.path())); |
| 268 } | 268 } |
| 269 | 269 |
| 270 } // namespace headless | 270 } // namespace headless |
| OLD | NEW |