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

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

Issue 2397453002: Asynchronously resolve getAvailability callbacks. (Closed)
Patch Set: fix compile 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..12aa1c5ba226ea462f043bd45339a2184f0cdbdf
--- /dev/null
+++ b/content/browser/presentation/presentation_browsertest.cc
@@ -0,0 +1,49 @@
+// 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/browser/web_contents.h"
+#include "content/public/test/browser_test.h"
+#include "content/public/test/content_browser_test.h"
+#include "content/public/test/content_browser_test_utils.h"
+#include "content/public/test/test_navigation_observer.h"
+#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.
+// TODO(mlamouri,mfoltz), update the test after [SameObject] is used,
+// see https://crbug.com/653131
+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(),
+ "const r = new PresentationRequest('foo.html')");
+
+ ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(),
+ "const p1 = r.getAvailability();");
+
+ ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(),
+ "const p2 = r.getAvailability()");
+
+ bool is_p1_undefined = false;
+ ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(),
+ "p1 === undefined")->GetAsBoolean(&is_p1_undefined);
+
+ 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