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

Side by Side Diff: content/browser/devtools/protocol/devtools_protocol_browsertest.cc

Issue 2247313002: Reenable CaptureScreenshot test for mac/msan builds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 class CaptureScreenshotTest : public DevToolsProtocolTest { 370 class CaptureScreenshotTest : public DevToolsProtocolTest {
371 private: 371 private:
372 #if !defined(OS_ANDROID) 372 #if !defined(OS_ANDROID)
373 void SetUpCommandLine(base::CommandLine* command_line) override { 373 void SetUpCommandLine(base::CommandLine* command_line) override {
374 command_line->AppendSwitch(switches::kEnablePixelOutputInTests); 374 command_line->AppendSwitch(switches::kEnablePixelOutputInTests);
375 } 375 }
376 #endif 376 #endif
377 }; 377 };
378 378
379 // Does not link on Android 379 // Does not link on Android
380 #if defined(OS_ANDROID) 380 #if !defined(OS_ANDROID)
381 #define MAYBE_CaptureScreenshot DISABLED_CaptureScreenshot 381 IN_PROC_BROWSER_TEST_F(CaptureScreenshotTest, CaptureScreenshot) {
382 #elif defined(OS_MACOSX) // Fails on 10.9. http://crbug.com/430620
383 #define MAYBE_CaptureScreenshot DISABLED_CaptureScreenshot
384 #elif defined(MEMORY_SANITIZER)
385 // Also fails under MSAN. http://crbug.com/423583
386 #define MAYBE_CaptureScreenshot DISABLED_CaptureScreenshot
387 #else
388 #define MAYBE_CaptureScreenshot CaptureScreenshot
389 #endif
390 IN_PROC_BROWSER_TEST_F(CaptureScreenshotTest, MAYBE_CaptureScreenshot) {
391 shell()->LoadURL(GURL("about:blank")); 382 shell()->LoadURL(GURL("about:blank"));
392 Attach(); 383 Attach();
393 EXPECT_TRUE(content::ExecuteScript( 384 EXPECT_TRUE(content::ExecuteScript(
394 shell()->web_contents()->GetRenderViewHost(), 385 shell()->web_contents()->GetRenderViewHost(),
395 "document.body.style.background = '#123456'")); 386 "document.body.style.background = '#123456'"));
396 SendCommand("Page.captureScreenshot", nullptr); 387 SendCommand("Page.captureScreenshot", nullptr);
397 std::string base64; 388 std::string base64;
398 EXPECT_TRUE(result_->GetString("data", &base64)); 389 EXPECT_TRUE(result_->GetString("data", &base64));
399 std::string png; 390 std::string png;
400 EXPECT_TRUE(base::Base64Decode(base64, &png)); 391 EXPECT_TRUE(base::Base64Decode(base64, &png));
401 SkBitmap bitmap; 392 SkBitmap bitmap;
402 gfx::PNGCodec::Decode(reinterpret_cast<const unsigned char*>(png.data()), 393 gfx::PNGCodec::Decode(reinterpret_cast<const unsigned char*>(png.data()),
403 png.size(), &bitmap); 394 png.size(), &bitmap);
404 SkColor color(bitmap.getColor(0, 0)); 395 SkColor color(bitmap.getColor(0, 0));
405 EXPECT_TRUE(std::abs(0x12-(int)SkColorGetR(color)) <= 1); 396 EXPECT_GE(1, std::abs(0x12-(int)SkColorGetR(color)));
406 EXPECT_TRUE(std::abs(0x34-(int)SkColorGetG(color)) <= 1); 397 EXPECT_GE(1, std::abs(0x34-(int)SkColorGetG(color)));
407 EXPECT_TRUE(std::abs(0x56-(int)SkColorGetB(color)) <= 1); 398 EXPECT_GE(1, std::abs(0x56-(int)SkColorGetB(color)));
399 color = bitmap.getColor(1, 1);
400 EXPECT_GE(1, std::abs(0x12-(int)SkColorGetR(color)));
401 EXPECT_GE(1, std::abs(0x34-(int)SkColorGetG(color)));
402 EXPECT_GE(1, std::abs(0x56-(int)SkColorGetB(color)));
408 } 403 }
404 #endif
409 405
410 #if defined(OS_ANDROID) 406 #if defined(OS_ANDROID)
411 // Disabled, see http://crbug.com/469947. 407 // Disabled, see http://crbug.com/469947.
412 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, DISABLED_SynthesizePinchGesture) { 408 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, DISABLED_SynthesizePinchGesture) {
413 GURL test_url = GetTestUrl("devtools", "synthetic_gesture_tests.html"); 409 GURL test_url = GetTestUrl("devtools", "synthetic_gesture_tests.html");
414 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 1); 410 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 1);
415 Attach(); 411 Attach();
416 412
417 int old_width; 413 int old_width;
418 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( 414 ASSERT_TRUE(content::ExecuteScriptAndExtractInt(
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 params->SetString("policy", "advance"); 877 params->SetString("policy", "advance");
882 params->SetInteger("budget", 1000); 878 params->SetInteger("budget", 1000);
883 SendCommand("Emulation.setVirtualTimePolicy", std::move(params), true); 879 SendCommand("Emulation.setVirtualTimePolicy", std::move(params), true);
884 880
885 WaitForNotification("Emulation.virtualTimeBudgetExpired"); 881 WaitForNotification("Emulation.virtualTimeBudgetExpired");
886 882
887 EXPECT_THAT(console_messages_, ElementsAre("before", "done", "after")); 883 EXPECT_THAT(console_messages_, ElementsAre("before", "done", "after"));
888 } 884 }
889 885
890 } // namespace content 886 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698