| 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..207a71694169f008827dd4d2dea7a10fe63f43ee 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,35 @@ IN_PROC_BROWSER_TEST_F(IsolatedDevToolsProtocolTest,
|
| "http://b.com/devtools/control_navigations/meta_tag.html"));
|
| }
|
|
|
| +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));
|
| +}
|
| +
|
| IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, VirtualTimeTest) {
|
| NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1);
|
| Attach();
|
|
|