Commit cd7f1f8e authored by Clifford Cheng's avatar Clifford Cheng Committed by Commit Bot

Enable pixel-by-pixel comparison test for Windows.

Fixed all the compile and runtime issues on Windows and enable the test on it.

Bug: 898230
Change-Id: I9e92e49583893898603bffa46f6fc6bdc1ef7e20
Reviewed-on: https://chromium-review.googlesource.com/c/1339240Reviewed-by: default avatarMounir Lamouri <mlamouri@chromium.org>
Commit-Queue: Clifford Cheng <cliffordcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612714}
parent c556e646
...@@ -190,7 +190,7 @@ IN_PROC_BROWSER_TEST_F(PictureInPictureWindowControllerBrowserTest, ...@@ -190,7 +190,7 @@ IN_PROC_BROWSER_TEST_F(PictureInPictureWindowControllerBrowserTest,
EXPECT_TRUE(window_controller()->GetWindowForTesting()->IsVisible()); EXPECT_TRUE(window_controller()->GetWindowForTesting()->IsVisible());
} }
#if (defined(OS_MACOSX) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) #if !defined(OS_CHROMEOS)
class PictureInPicturePixelComparisonBrowserTest class PictureInPicturePixelComparisonBrowserTest
: public PictureInPictureWindowControllerBrowserTest { : public PictureInPictureWindowControllerBrowserTest {
public: public:
...@@ -222,9 +222,6 @@ class PictureInPicturePixelComparisonBrowserTest ...@@ -222,9 +222,6 @@ class PictureInPicturePixelComparisonBrowserTest
} }
bool SaveBitmap(base::FilePath& file_path, SkBitmap& bitmap) { bool SaveBitmap(base::FilePath& file_path, SkBitmap& bitmap) {
base::File file(file_path,
base::File::FLAG_OPEN | base::File::FLAG_OPEN_ALWAYS);
CHECK(file.IsValid());
std::vector<unsigned char> png_data; std::vector<unsigned char> png_data;
CHECK(gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &png_data)); CHECK(gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &png_data));
char* data = reinterpret_cast<char*>(&png_data[0]); char* data = reinterpret_cast<char*>(&png_data[0]);
...@@ -333,12 +330,13 @@ IN_PROC_BROWSER_TEST_F(PictureInPicturePixelComparisonBrowserTest, VideoPlay) { ...@@ -333,12 +330,13 @@ IN_PROC_BROWSER_TEST_F(PictureInPicturePixelComparisonBrowserTest, VideoPlay) {
Wait(base::TimeDelta::FromSeconds(3)); Wait(base::TimeDelta::FromSeconds(3));
TakeOverlayWindowScreenshot(overlay_window_views); TakeOverlayWindowScreenshot(overlay_window_views);
std::string test_image = "pixel_test_actual_0.png"; const base::FilePath::StringPieceType test_image =
FILE_PATH_LITERAL("pixel_test_actual_0.png");
base::FilePath test_image_path = GetFilePath(test_image); base::FilePath test_image_path = GetFilePath(test_image);
ASSERT_TRUE(SaveBitmap(test_image_path, GetResultBitmap())); ASSERT_TRUE(SaveBitmap(test_image_path, GetResultBitmap()));
EXPECT_TRUE(CompareImages(GetResultBitmap())); EXPECT_TRUE(CompareImages(GetResultBitmap()));
} }
#endif // (defined(OS_MACOSX) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) #endif // !defined(OS_CHROMEOS)
// Tests that when an active WebContents accurately tracks whether a video // Tests that when an active WebContents accurately tracks whether a video
// is in Picture-in-Picture. // is in Picture-in-Picture.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment