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

Unified Diff: headless/lib/headless_web_contents_browsertest.cc

Issue 2641073004: Revert of [headless] Fix screenshots with gpu enabled. (Closed)
Patch Set: Created 3 years, 11 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 | « headless/lib/DEPS ('k') | headless/test/headless_browser_test.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/lib/headless_web_contents_browsertest.cc
diff --git a/headless/lib/headless_web_contents_browsertest.cc b/headless/lib/headless_web_contents_browsertest.cc
index 03097ca13d1269205bde14bbd2ce1af7e546e543..18b4295c2b94e42e8db687ebd4652e6a5750af99 100644
--- a/headless/lib/headless_web_contents_browsertest.cc
+++ b/headless/lib/headless_web_contents_browsertest.cc
@@ -6,10 +6,8 @@
#include <string>
#include <vector>
-#include "base/base64.h"
#include "content/public/test/browser_test.h"
#include "headless/public/devtools/domains/page.h"
-#include "headless/public/devtools/domains/runtime.h"
#include "headless/public/devtools/domains/security.h"
#include "headless/public/headless_browser.h"
#include "headless/public/headless_devtools_client.h"
@@ -17,9 +15,6 @@
#include "headless/test/headless_browser_test.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-#include "third_party/skia/include/core/SkColor.h"
-#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/geometry/size.h"
#include "url/gurl.h"
@@ -61,41 +56,10 @@
browser_context->GetAllWebContents().size());
}
-namespace {
-bool DecodePNG(std::string base64_data, SkBitmap* bitmap) {
- std::string png_data;
- if (!base::Base64Decode(base64_data, &png_data))
- return false;
- return gfx::PNGCodec::Decode(
- reinterpret_cast<unsigned const char*>(png_data.data()), png_data.size(),
- bitmap);
-}
-} // namespace
-
-// Parameter specifies whether --disable-gpu should be used.
class HeadlessWebContentsScreenshotTest
- : public HeadlessAsyncDevTooledBrowserTest,
- public ::testing::WithParamInterface<bool> {
+ : public HeadlessAsyncDevTooledBrowserTest {
public:
- void SetUp() override {
- EnablePixelOutput();
- if (GetParam())
- UseSoftwareCompositing();
- HeadlessAsyncDevTooledBrowserTest::SetUp();
- }
-
void RunDevTooledTest() override {
- std::unique_ptr<runtime::EvaluateParams> params =
- runtime::EvaluateParams::Builder()
- .SetExpression("document.body.style.background = '#0000ff'")
- .Build();
- devtools_client_->GetRuntime()->Evaluate(
- std::move(params),
- base::Bind(&HeadlessWebContentsScreenshotTest::OnPageSetupCompleted,
- base::Unretained(this)));
- }
-
- void OnPageSetupCompleted(std::unique_ptr<runtime::EvaluateResult> result) {
devtools_client_->GetPage()->GetExperimental()->CaptureScreenshot(
page::CaptureScreenshotParams::Builder().Build(),
base::Bind(&HeadlessWebContentsScreenshotTest::OnScreenshotCaptured,
@@ -104,26 +68,12 @@
void OnScreenshotCaptured(
std::unique_ptr<page::CaptureScreenshotResult> result) {
- std::string base64 = result->GetData();
- EXPECT_LT(0U, base64.length());
- SkBitmap result_bitmap;
- EXPECT_TRUE(DecodePNG(base64, &result_bitmap));
-
- EXPECT_EQ(800, result_bitmap.width());
- EXPECT_EQ(600, result_bitmap.height());
- SkColor actual_color = result_bitmap.getColor(400, 300);
- SkColor expected_color = SkColorSetRGB(0x00, 0x00, 0xff);
- EXPECT_EQ(expected_color, actual_color);
+ EXPECT_LT(0U, result->GetData().length());
FinishAsynchronousTest();
}
};
-HEADLESS_ASYNC_DEVTOOLED_TEST_P(HeadlessWebContentsScreenshotTest);
-
-// Instantiate test case for both software and gpu compositing modes.
-INSTANTIATE_TEST_CASE_P(HeadlessWebContentsScreenshotTests,
- HeadlessWebContentsScreenshotTest,
- ::testing::Bool());
+HEADLESS_ASYNC_DEVTOOLED_TEST_F(HeadlessWebContentsScreenshotTest);
class HeadlessWebContentsSecurityTest
: public HeadlessAsyncDevTooledBrowserTest,
« no previous file with comments | « headless/lib/DEPS ('k') | headless/test/headless_browser_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698