Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/public/test/browser_test.h" | |
| 6 #include "content/public/test/content_browser_test.h" | |
| 7 #include "content/public/test/content_browser_test_utils.cc" | |
| 8 #include "content/shell/browser/shell.h" | |
| 9 | |
| 10 namespace content { | |
| 11 | |
| 12 using PresentationBrowserTest = ContentBrowserTest; | |
| 13 | |
| 14 // Regression test that verifies that calling getAvailability() twice on the | |
| 15 // same PresentationRequest does not return an undefined object. | |
| 16 IN_PROC_BROWSER_TEST_F(PresentationBrowserTest, AvailabilityNotUndefined) { | |
| 17 GURL test_url = GetTestUrl("", "hello.html"); | |
| 18 | |
| 19 TestNavigationObserver navigation_observer(shell()->web_contents(), 1); | |
| 20 shell()->LoadURL(test_url); | |
| 21 | |
| 22 navigation_observer.Wait(); | |
| 23 | |
| 24 ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(), | |
| 25 "var r = new PresentationRequest('foo.html')"); | |
|
mark a. foltz
2016/10/05 16:04:01
nit: s/var/const/ here and below (assuming it does
mlamouri (slow - plz ping)
2016/10/05 16:43:13
Sure.
| |
| 26 | |
| 27 ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(), | |
| 28 "var p1 = r.getAvailability();"); | |
| 29 | |
| 30 ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(), | |
| 31 "var p2 = r.getAvailability()"); | |
| 32 | |
| 33 bool is_p1_undefined = false; | |
| 34 ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(), | |
| 35 "p1 === undefined")->GetAsBoolean(&is_p1_undefined); | |
|
mark a. foltz
2016/10/05 16:04:01
There's a spec change coming that getAvailability(
mlamouri (slow - plz ping)
2016/10/05 16:43:13
Done. Though, I would expect us to test this in Bl
| |
| 36 | |
| 37 bool is_p2_undefined = false; | |
| 38 ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(), | |
| 39 "p2 === undefined")->GetAsBoolean(&is_p2_undefined); | |
| 40 | |
| 41 EXPECT_FALSE(is_p1_undefined); | |
| 42 EXPECT_FALSE(is_p2_undefined); | |
| 43 } | |
| 44 | |
| 45 } // namespace content | |
| OLD | NEW |