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

Unified Diff: chrome/browser/pdf/pdf_extension_test_util.cc

Issue 1237343002: Fix nested GuestView's container bounds calculation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pdf_extension_util -> pdf_extension_test_util Created 5 years, 5 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
Index: chrome/browser/pdf/pdf_extension_test_util.cc
diff --git a/chrome/browser/pdf/pdf_extension_test_util.cc b/chrome/browser/pdf/pdf_extension_test_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2d992422b82de2bbec4d574437cc7f50dc87ac82
--- /dev/null
+++ b/chrome/browser/pdf/pdf_extension_test_util.cc
@@ -0,0 +1,32 @@
+// Copyright 2015 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 "chrome/browser/pdf/pdf_extension_test_util.h"
+
+#include "content/public/test/browser_test_utils.h"
+#include "grit/component_extension_resources.h"
+#include "ui/base/resource/resource_bundle.h"
+
+namespace pdf_extension_test_util {
+
+bool EnsurePDFHasLoaded(content::WebContents* web_contents) {
+ std::string scripting_api_js =
+ ResourceBundle::GetSharedInstance()
+ .GetRawDataResource(IDR_PDF_PDF_SCRIPTING_API_JS)
+ .as_string();
+ CHECK(content::ExecuteScript(web_contents, scripting_api_js));
+
+ bool load_success = false;
+ CHECK(content::ExecuteScriptAndExtractBool(
+ web_contents,
+ "var scriptingAPI = new PDFScriptingAPI(window, "
+ " document.getElementsByTagName('embed')[0]);"
+ "scriptingAPI.setLoadCallback(function(success) {"
+ " window.domAutomationController.send(success);"
+ "});",
+ &load_success));
+ return load_success;
+}
+
+} // namespace pdf_extension_test_util

Powered by Google App Engine
This is Rietveld 408576698