| 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 "chrome/browser/permissions/permissions_browsertest.h" | 5 #include "chrome/browser/permissions/permissions_browsertest.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/permissions/permission_request_manager.h" | 8 #include "chrome/browser/permissions/permission_request_manager.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/permission_bubble/mock_permission_prompt_factory.h" | 10 #include "chrome/browser/ui/permission_bubble/mock_permission_prompt_factory.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 manager->DisplayPendingRequests(); | 27 manager->DisplayPendingRequests(); |
| 28 | 28 |
| 29 ASSERT_TRUE(embedded_test_server()->Start()); | 29 ASSERT_TRUE(embedded_test_server()->Start()); |
| 30 | 30 |
| 31 ui_test_utils::NavigateToURL(browser(), | 31 ui_test_utils::NavigateToURL(browser(), |
| 32 embedded_test_server()->GetURL(test_url())); | 32 embedded_test_server()->GetURL(test_url())); |
| 33 } | 33 } |
| 34 | 34 |
| 35 void PermissionsBrowserTest::TearDownOnMainThread() { | 35 void PermissionsBrowserTest::TearDownOnMainThread() { |
| 36 prompt_factory_.reset(); | 36 prompt_factory_.reset(); |
| 37 | |
| 38 InProcessBrowserTest::TearDownOnMainThread(); | |
| 39 } | 37 } |
| 40 | 38 |
| 41 bool PermissionsBrowserTest::RunScriptReturnBool(const std::string& script) { | 39 bool PermissionsBrowserTest::RunScriptReturnBool(const std::string& script) { |
| 42 bool result; | 40 bool result; |
| 43 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 41 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
| 44 GetWebContents()->GetMainFrame(), script, &result)); | 42 GetWebContents()->GetMainFrame(), script, &result)); |
| 45 return result; | 43 return result; |
| 46 } | 44 } |
| 47 | 45 |
| 48 content::WebContents* PermissionsBrowserTest::GetWebContents() { | 46 content::WebContents* PermissionsBrowserTest::GetWebContents() { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 75 } | 73 } |
| 76 | 74 |
| 77 void PermissionsBrowserTest::CommonSucceedsIfAllowed() { | 75 void PermissionsBrowserTest::CommonSucceedsIfAllowed() { |
| 78 EXPECT_EQ(0, prompt_factory()->TotalRequestCount()); | 76 EXPECT_EQ(0, prompt_factory()->TotalRequestCount()); |
| 79 prompt_factory()->set_response_type(PermissionRequestManager::ACCEPT_ALL); | 77 prompt_factory()->set_response_type(PermissionRequestManager::ACCEPT_ALL); |
| 80 TriggerPrompt(); | 78 TriggerPrompt(); |
| 81 | 79 |
| 82 EXPECT_TRUE(FeatureUsageSucceeds()); | 80 EXPECT_TRUE(FeatureUsageSucceeds()); |
| 83 EXPECT_EQ(1, prompt_factory()->TotalRequestCount()); | 81 EXPECT_EQ(1, prompt_factory()->TotalRequestCount()); |
| 84 } | 82 } |
| OLD | NEW |