| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_enumerator.h" | 8 #include "base/files/file_enumerator.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 ->GetAsInteger(&screen_height)); | 372 ->GetAsInteger(&screen_height)); |
| 373 EXPECT_TRUE(EvaluateScript(web_contents, "window.innerWidth") | 373 EXPECT_TRUE(EvaluateScript(web_contents, "window.innerWidth") |
| 374 ->GetResult() | 374 ->GetResult() |
| 375 ->GetValue() | 375 ->GetValue() |
| 376 ->GetAsInteger(&window_width)); | 376 ->GetAsInteger(&window_width)); |
| 377 EXPECT_TRUE(EvaluateScript(web_contents, "window.innerHeight") | 377 EXPECT_TRUE(EvaluateScript(web_contents, "window.innerHeight") |
| 378 ->GetResult() | 378 ->GetResult() |
| 379 ->GetValue() | 379 ->GetValue() |
| 380 ->GetAsInteger(&window_height)); | 380 ->GetAsInteger(&window_height)); |
| 381 | 381 |
| 382 #if !defined(OS_MACOSX) |
| 383 // On Mac headless does not override the screen dimensions, so they are |
| 384 // left with the actual screen values. |
| 382 EXPECT_EQ(kDefaultOptions.window_size.width(), screen_width); | 385 EXPECT_EQ(kDefaultOptions.window_size.width(), screen_width); |
| 383 EXPECT_EQ(kDefaultOptions.window_size.height(), screen_height); | 386 EXPECT_EQ(kDefaultOptions.window_size.height(), screen_height); |
| 387 #endif // !defined(OS_MACOSX) |
| 384 EXPECT_EQ(kDefaultOptions.window_size.width(), window_width); | 388 EXPECT_EQ(kDefaultOptions.window_size.width(), window_width); |
| 385 EXPECT_EQ(kDefaultOptions.window_size.height(), window_height); | 389 EXPECT_EQ(kDefaultOptions.window_size.height(), window_height); |
| 386 } | 390 } |
| 387 | 391 |
| 388 namespace { | 392 namespace { |
| 389 | 393 |
| 390 // True if the request method is "safe" (per section 4.2.1 of RFC 7231). | 394 // True if the request method is "safe" (per section 4.2.1 of RFC 7231). |
| 391 bool IsMethodSafe(const std::string& method) { | 395 bool IsMethodSafe(const std::string& method) { |
| 392 return method == "GET" || method == "HEAD" || method == "OPTIONS" || | 396 return method == "GET" || method == "HEAD" || method == "OPTIONS" || |
| 393 method == "TRACE"; | 397 method == "TRACE"; |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 web_contents->browser_context()->GetPermissionManager(); | 778 web_contents->browser_context()->GetPermissionManager(); |
| 775 EXPECT_NE(nullptr, permission_manager); | 779 EXPECT_NE(nullptr, permission_manager); |
| 776 | 780 |
| 777 // Check that the permission manager returns ASK for a given permission type. | 781 // Check that the permission manager returns ASK for a given permission type. |
| 778 EXPECT_EQ(blink::mojom::PermissionStatus::ASK, | 782 EXPECT_EQ(blink::mojom::PermissionStatus::ASK, |
| 779 permission_manager->GetPermissionStatus( | 783 permission_manager->GetPermissionStatus( |
| 780 content::PermissionType::NOTIFICATIONS, url, url)); | 784 content::PermissionType::NOTIFICATIONS, url, url)); |
| 781 } | 785 } |
| 782 | 786 |
| 783 } // namespace headless | 787 } // namespace headless |
| OLD | NEW |