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

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

Issue 2908133003: Split GetPermissionStatus into GetPermissionStatusForFrame/Worker
Patch Set: Split GetPermissionStatus into GetPermissionStatusForFrame/Worker Created 3 years, 6 months 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 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 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 browser_context->CreateWebContentsBuilder().Build(); 770 browser_context->CreateWebContentsBuilder().Build();
771 EXPECT_TRUE(headless_web_contents); 771 EXPECT_TRUE(headless_web_contents);
772 772
773 HeadlessWebContentsImpl* web_contents = 773 HeadlessWebContentsImpl* web_contents =
774 HeadlessWebContentsImpl::From(headless_web_contents); 774 HeadlessWebContentsImpl::From(headless_web_contents);
775 775
776 content::PermissionManager* permission_manager = 776 content::PermissionManager* permission_manager =
777 web_contents->browser_context()->GetPermissionManager(); 777 web_contents->browser_context()->GetPermissionManager();
778 EXPECT_NE(nullptr, permission_manager); 778 EXPECT_NE(nullptr, permission_manager);
779 779
780 // Check that the permission manager returns ASK for a given permission type. 780 // Check that the permission manager returns ASK for a given permission type,
781 // and DENIED for a worker.
781 EXPECT_EQ(blink::mojom::PermissionStatus::ASK, 782 EXPECT_EQ(blink::mojom::PermissionStatus::ASK,
782 permission_manager->GetPermissionStatus( 783 permission_manager->GetPermissionStatusForFrame(
783 content::PermissionType::NOTIFICATIONS, url, url)); 784 content::PermissionType::NOTIFICATIONS,
785 /*render_frame_host=*/nullptr, url));
786 EXPECT_EQ(blink::mojom::PermissionStatus::DENIED,
787 permission_manager->GetPermissionStatusForWorker(
788 content::PermissionType::NOTIFICATIONS, url));
784 } 789 }
785 790
786 class HeadlessBrowserTestWithNetLog : public HeadlessBrowserTest { 791 class HeadlessBrowserTestWithNetLog : public HeadlessBrowserTest {
787 public: 792 public:
788 HeadlessBrowserTestWithNetLog() {} 793 HeadlessBrowserTestWithNetLog() {}
789 794
790 void SetUp() override { 795 void SetUp() override {
791 base::ThreadRestrictions::SetIOAllowed(true); 796 base::ThreadRestrictions::SetIOAllowed(true);
792 EXPECT_TRUE(base::CreateTemporaryFile(&net_log_)); 797 EXPECT_TRUE(base::CreateTemporaryFile(&net_log_));
793 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( 798 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 HeadlessWebContents* web_contents = 909 HeadlessWebContents* web_contents =
905 browser_context->CreateWebContentsBuilder() 910 browser_context->CreateWebContentsBuilder()
906 .SetInitialURL(embedded_test_server()->GetURL("/hello.html")) 911 .SetInitialURL(embedded_test_server()->GetURL("/hello.html"))
907 .Build(); 912 .Build();
908 EXPECT_TRUE(WaitForLoad(web_contents)); 913 EXPECT_TRUE(WaitForLoad(web_contents));
909 EXPECT_FALSE( 914 EXPECT_FALSE(
910 EvaluateScript(web_contents, "window.print()")->HasExceptionDetails()); 915 EvaluateScript(web_contents, "window.print()")->HasExceptionDetails());
911 } 916 }
912 917
913 } // namespace headless 918 } // namespace headless
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698