Chromium Code Reviews| Index: content/browser/presentation/presentation_browsertest.cc |
| diff --git a/content/browser/presentation/presentation_browsertest.cc b/content/browser/presentation/presentation_browsertest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..17e0b32241312a49454dba647d9ca5dc594aaa29 |
| --- /dev/null |
| +++ b/content/browser/presentation/presentation_browsertest.cc |
| @@ -0,0 +1,45 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "content/public/test/browser_test.h" |
| +#include "content/public/test/content_browser_test.h" |
| +#include "content/public/test/content_browser_test_utils.cc" |
| +#include "content/shell/browser/shell.h" |
| + |
| +namespace content { |
| + |
| +using PresentationBrowserTest = ContentBrowserTest; |
| + |
| +// Regression test that verifies that calling getAvailability() twice on the |
| +// same PresentationRequest does not return an undefined object. |
| +IN_PROC_BROWSER_TEST_F(PresentationBrowserTest, AvailabilityNotUndefined) { |
| + GURL test_url = GetTestUrl("", "hello.html"); |
| + |
| + TestNavigationObserver navigation_observer(shell()->web_contents(), 1); |
| + shell()->LoadURL(test_url); |
| + |
| + navigation_observer.Wait(); |
| + |
| + ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(), |
| + "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.
|
| + |
| + ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(), |
| + "var p1 = r.getAvailability();"); |
| + |
| + ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(), |
| + "var p2 = r.getAvailability()"); |
| + |
| + bool is_p1_undefined = false; |
| + ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(), |
| + "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
|
| + |
| + bool is_p2_undefined = false; |
| + ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(), |
| + "p2 === undefined")->GetAsBoolean(&is_p2_undefined); |
| + |
| + EXPECT_FALSE(is_p1_undefined); |
| + EXPECT_FALSE(is_p2_undefined); |
| +} |
| + |
| +} // namespace content |