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 // This file contains browsertests for Web Bluetooth that depend on behavior | 5 // This file contains browsertests for Web Bluetooth that depend on behavior |
6 // defined in chrome/, not just in content/. | 6 // defined in chrome/, not just in content/. |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "chrome/browser/permissions/permission_context_base.h" | 10 #include "chrome/browser/permissions/permission_context_base.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 EXPECT_EQ("NotFoundError: Bluetooth adapter not available.", result); | 71 EXPECT_EQ("NotFoundError: Bluetooth adapter not available.", result); |
72 | 72 |
73 // Crash the renderer process. | 73 // Crash the renderer process. |
74 content::RenderProcessHost* process = web_contents_->GetRenderProcessHost(); | 74 content::RenderProcessHost* process = web_contents_->GetRenderProcessHost(); |
75 content::RenderProcessHostWatcher crash_observer( | 75 content::RenderProcessHostWatcher crash_observer( |
76 process, content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); | 76 process, content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); |
77 process->Shutdown(0, false); | 77 process->Shutdown(0, false); |
78 crash_observer.Wait(); | 78 crash_observer.Wait(); |
79 | 79 |
80 // Reload tab. | 80 // Reload tab. |
81 chrome::Reload(browser(), CURRENT_TAB); | 81 chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB); |
82 content::WaitForLoadStop( | 82 content::WaitForLoadStop( |
83 browser()->tab_strip_model()->GetActiveWebContents()); | 83 browser()->tab_strip_model()->GetActiveWebContents()); |
84 | 84 |
85 // Use Web Bluetooth again. | 85 // Use Web Bluetooth again. |
86 std::string result_after_crash; | 86 std::string result_after_crash; |
87 EXPECT_TRUE(content::ExecuteScriptAndExtractString( | 87 EXPECT_TRUE(content::ExecuteScriptAndExtractString( |
88 web_contents_, | 88 web_contents_, |
89 "navigator.bluetooth.requestDevice({filters: [{services: [0x180d]}]})" | 89 "navigator.bluetooth.requestDevice({filters: [{services: [0x180d]}]})" |
90 " .catch(e => domAutomationController.send(e.toString()));", | 90 " .catch(e => domAutomationController.send(e.toString()));", |
91 &result_after_crash)); | 91 &result_after_crash)); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 " .then(() => { domAutomationController.send('Success'); }," | 145 " .then(() => { domAutomationController.send('Success'); }," |
146 " reason => {" | 146 " reason => {" |
147 " domAutomationController.send(reason.name + ': ' + reason.message);" | 147 " domAutomationController.send(reason.name + ': ' + reason.message);" |
148 " });", | 148 " });", |
149 &rejection)); | 149 &rejection)); |
150 EXPECT_THAT(rejection, | 150 EXPECT_THAT(rejection, |
151 testing::MatchesRegex("SecurityError: .*blacklisted UUID.*")); | 151 testing::MatchesRegex("SecurityError: .*blacklisted UUID.*")); |
152 } | 152 } |
153 | 153 |
154 } // namespace | 154 } // namespace |
OLD | NEW |