Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1146)

Unified Diff: content/browser/presentation/presentation_browsertest.cc

Issue 2397453002: Asynchronously resolve getAvailability callbacks. (Closed)
Patch Set: add tests Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/renderer/presentation/presentation_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | content/renderer/presentation/presentation_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698