| 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/browser/web_contents.h" |
| 6 #include "content/public/test/browser_test.h" |
| 7 #include "content/public/test/content_browser_test.h" |
| 8 #include "content/public/test/content_browser_test_utils.h" |
| 9 #include "content/public/test/test_navigation_observer.h" |
| 10 #include "content/shell/browser/shell.h" |
| 11 |
| 12 namespace content { |
| 13 |
| 14 using PresentationBrowserTest = ContentBrowserTest; |
| 15 |
| 16 // Regression test that verifies that calling getAvailability() twice on the |
| 17 // same PresentationRequest does not return an undefined object. |
| 18 // TODO(mlamouri,mfoltz), update the test after [SameObject] is used, |
| 19 // see https://crbug.com/653131 |
| 20 IN_PROC_BROWSER_TEST_F(PresentationBrowserTest, AvailabilityNotUndefined) { |
| 21 GURL test_url = GetTestUrl("", "hello.html"); |
| 22 |
| 23 TestNavigationObserver navigation_observer(shell()->web_contents(), 1); |
| 24 shell()->LoadURL(test_url); |
| 25 |
| 26 navigation_observer.Wait(); |
| 27 |
| 28 ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(), |
| 29 "const r = new PresentationRequest('foo.html')"); |
| 30 |
| 31 ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(), |
| 32 "const p1 = r.getAvailability();"); |
| 33 |
| 34 ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(), |
| 35 "const p2 = r.getAvailability()"); |
| 36 |
| 37 bool is_p1_undefined = false; |
| 38 ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(), |
| 39 "p1 === undefined")->GetAsBoolean(&is_p1_undefined); |
| 40 |
| 41 bool is_p2_undefined = false; |
| 42 ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(), |
| 43 "p2 === undefined")->GetAsBoolean(&is_p2_undefined); |
| 44 |
| 45 EXPECT_FALSE(is_p1_undefined); |
| 46 EXPECT_FALSE(is_p2_undefined); |
| 47 } |
| 48 |
| 49 } // namespace content |
| OLD | NEW |