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

Unified Diff: content/browser/devtools/protocol/devtools_protocol_browsertest.cc

Issue 2226323002: Resize DevTools target frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: No support for setFrameSize on Android. Created 4 years, 4 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/browser/devtools/protocol/emulation_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/devtools/protocol/devtools_protocol_browsertest.cc
diff --git a/content/browser/devtools/protocol/devtools_protocol_browsertest.cc b/content/browser/devtools/protocol/devtools_protocol_browsertest.cc
index 0c577b651df47ac9e6df319f0b71e1cd4f610cc1..a80ba2ae63ca7984e8d9066dedc99aba92495839 100644
--- a/content/browser/devtools/protocol/devtools_protocol_browsertest.cc
+++ b/content/browser/devtools/protocol/devtools_protocol_browsertest.cc
@@ -19,6 +19,7 @@
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_view_host.h"
+#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/url_constants.h"
#include "content/public/test/browser_test_utils.h"
@@ -33,6 +34,12 @@
#include "ui/compositor/compositor_switches.h"
#include "ui/gfx/codec/png_codec.h"
+#define EXPECT_SIZE_EQ(expected, actual) \
+ do { \
+ EXPECT_EQ((expected).width(), (actual).width()); \
+ EXPECT_EQ((expected).height(), (actual).height()); \
+ } while (false)
+
using testing::ElementsAre;
namespace content {
@@ -846,6 +853,38 @@ IN_PROC_BROWSER_TEST_F(IsolatedDevToolsProtocolTest,
"http://b.com/devtools/control_navigations/meta_tag.html"));
}
+// Setting frame size (through RWHV) is not supported on Android.
+#if !defined(OS_ANDROID)
Sami 2016/08/18 14:24:53 nit: Please use the MAYBE_ pattern[1] to disable t
+IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, EmulationGetAndSetFrameSize) {
+ NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1);
+ Attach();
+ int width, height = 0;
+
+ // Get default size.
+ SendCommand("Emulation.getFrameSize", nullptr, true);
+ EXPECT_TRUE(result_->GetInteger("width", &width));
+ EXPECT_TRUE(result_->GetInteger("height", &height));
+ EXPECT_SIZE_EQ(shell()->GetShellDefaultSize(), gfx::Size(width, height));
+
+ // Resize frame.
+ gfx::Size new_size(200, 400);
+ std::unique_ptr<base::DictionaryValue> params(new base::DictionaryValue());
+ params->SetInteger("width", new_size.width());
+ params->SetInteger("height", new_size.height());
+ SendCommand("Emulation.setFrameSize", std::move(params), true);
+ EXPECT_SIZE_EQ(new_size, (shell()->web_contents())
+ ->GetRenderWidgetHostView()
+ ->GetViewBounds()
+ .size());
+
+ // Get updated size.
+ SendCommand("Emulation.getFrameSize", std::move(params), true);
+ EXPECT_TRUE(result_->GetInteger("width", &width));
+ EXPECT_TRUE(result_->GetInteger("height", &height));
+ EXPECT_SIZE_EQ(new_size, gfx::Size(width, height));
+}
+#endif // !defined(OS_ANDROID)
+
IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, VirtualTimeTest) {
NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1);
Attach();
« no previous file with comments | « no previous file | content/browser/devtools/protocol/emulation_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698