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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 HeadlessBrowserContext* another_browser_context = | 189 HeadlessBrowserContext* another_browser_context = |
190 browser()->CreateBrowserContextBuilder().Build(); | 190 browser()->CreateBrowserContextBuilder().Build(); |
191 | 191 |
192 // Loading the same non-existent page using a tab with a different context | 192 // Loading the same non-existent page using a tab with a different context |
193 // should not work since the protocol handler only exists on the custom | 193 // should not work since the protocol handler only exists on the custom |
194 // context. | 194 // context. |
195 web_contents = | 195 web_contents = |
196 another_browser_context->CreateWebContentsBuilder() | 196 another_browser_context->CreateWebContentsBuilder() |
197 .SetInitialURL(GURL("http://not-an-actual-domain.tld/hello.html")) | 197 .SetInitialURL(GURL("http://not-an-actual-domain.tld/hello.html")) |
198 .Build(); | 198 .Build(); |
199 EXPECT_TRUE(WaitForLoad(web_contents)); | 199 EXPECT_FALSE(WaitForLoad(web_contents)); |
200 EXPECT_TRUE(EvaluateScript(web_contents, "document.body.innerHTML") | 200 EXPECT_TRUE(EvaluateScript(web_contents, "document.body.innerHTML") |
201 ->GetResult() | 201 ->GetResult() |
202 ->GetValue() | 202 ->GetValue() |
203 ->GetAsString(&inner_html)); | 203 ->GetAsString(&inner_html)); |
204 EXPECT_EQ("", inner_html); | 204 EXPECT_EQ("", inner_html); |
205 web_contents->Close(); | 205 web_contents->Close(); |
206 } | 206 } |
207 | 207 |
208 IN_PROC_BROWSER_TEST_F(HeadlessBrowserTest, UserDataDir) { | 208 IN_PROC_BROWSER_TEST_F(HeadlessBrowserTest, UserDataDir) { |
209 // We do not want to bother with posting tasks to create a temp dir. | 209 // We do not want to bother with posting tasks to create a temp dir. |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 | 290 |
291 // Verify that the preference takes effect. | 291 // Verify that the preference takes effect. |
292 HeadlessWebContentsImpl* contents_impl = | 292 HeadlessWebContentsImpl* contents_impl = |
293 HeadlessWebContentsImpl::From(web_contents); | 293 HeadlessWebContentsImpl::From(web_contents); |
294 EXPECT_TRUE(contents_impl->web_contents() | 294 EXPECT_TRUE(contents_impl->web_contents() |
295 ->GetRenderViewHost() | 295 ->GetRenderViewHost() |
296 ->GetWebkitPreferences().hide_scrollbars); | 296 ->GetWebkitPreferences().hide_scrollbars); |
297 } | 297 } |
298 | 298 |
299 } // namespace headless | 299 } // namespace headless |
OLD | NEW |