summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
Diffstat (limited to 'cc')
-rw-r--r--cc/base/switches.cc3
-rw-r--r--cc/base/switches.h1
-rw-r--r--cc/test/layer_tree_pixel_test.cc7
-rw-r--r--cc/test/pixel_test.cc7
4 files changed, 14 insertions, 4 deletions
diff --git a/cc/base/switches.cc b/cc/base/switches.cc
index 2eab547..be4a2c5 100644
--- a/cc/base/switches.cc
+++ b/cc/base/switches.cc
@@ -141,6 +141,9 @@ const char kDisableMapImage[] = "disable-map-image";
// Prevents the layer tree unit tests from timing out.
const char kCCLayerTreeTestNoTimeout[] = "cc-layer-tree-test-no-timeout";
+// Makes pixel tests write their output instead of read it.
+const char kCCRebaselinePixeltests[] = "cc-rebaseline-pixeltests";
+
// Disable textures using RGBA_4444 layout.
const char kDisable4444Textures[] = "disable-4444-textures";
diff --git a/cc/base/switches.h b/cc/base/switches.h
index ed6555a..e92eb2e 100644
--- a/cc/base/switches.h
+++ b/cc/base/switches.h
@@ -69,6 +69,7 @@ CC_EXPORT extern const char kUIShowNonOccludingRects[];
// Unit test related.
CC_EXPORT extern const char kCCLayerTreeTestNoTimeout[];
+CC_EXPORT extern const char kCCRebaselinePixeltests[];
CC_EXPORT bool IsLCDTextEnabled();
CC_EXPORT bool IsImplSidePaintingEnabled();
diff --git a/cc/test/layer_tree_pixel_test.cc b/cc/test/layer_tree_pixel_test.cc
index 70e6223..d0a5c59 100644
--- a/cc/test/layer_tree_pixel_test.cc
+++ b/cc/test/layer_tree_pixel_test.cc
@@ -4,7 +4,9 @@
#include "cc/test/layer_tree_pixel_test.h"
+#include "base/command_line.h"
#include "base/path_service.h"
+#include "cc/base/switches.h"
#include "cc/layers/solid_color_layer.h"
#include "cc/layers/texture_layer.h"
#include "cc/output/copy_output_request.h"
@@ -96,8 +98,9 @@ void LayerTreePixelTest::AfterTest() {
EXPECT_TRUE(PathService::Get(cc::DIR_TEST_DATA, &test_data_dir));
base::FilePath ref_file_path = test_data_dir.Append(ref_file_);
- // To rebaseline:
- // EXPECT_TRUE(WritePNGFile(*result_bitmap_, ref_file_path, true));
+ CommandLine* cmd = CommandLine::ForCurrentProcess();
+ if (cmd->HasSwitch(switches::kCCRebaselinePixeltests))
+ EXPECT_TRUE(WritePNGFile(*result_bitmap_, ref_file_path, true));
EXPECT_TRUE(MatchesPNGFile(*result_bitmap_,
ref_file_path,
diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc
index 8504c28..12b729b 100644
--- a/cc/test/pixel_test.cc
+++ b/cc/test/pixel_test.cc
@@ -4,8 +4,10 @@
#include "cc/test/pixel_test.h"
+#include "base/command_line.h"
#include "base/path_service.h"
#include "base/run_loop.h"
+#include "cc/base/switches.h"
#include "cc/output/compositor_frame_metadata.h"
#include "cc/output/copy_output_request.h"
#include "cc/output/copy_output_result.h"
@@ -147,8 +149,9 @@ bool PixelTest::PixelsMatchReference(const base::FilePath& ref_file,
if (!result_bitmap_)
return false;
- // To rebaseline:
- // return WritePNGFile(*result_bitmap_, test_data_dir.Append(ref_file), true);
+ CommandLine* cmd = CommandLine::ForCurrentProcess();
+ if (cmd->HasSwitch(switches::kCCRebaselinePixeltests))
+ return WritePNGFile(*result_bitmap_, test_data_dir.Append(ref_file), true);
return MatchesPNGFile(*result_bitmap_,
test_data_dir.Append(ref_file),