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

Unified Diff: sky/tools/tester/tester.cc

Issue 797063002: Make reftests work for sky. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: address review comments Created 6 years 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 | « sky/tools/tester/test_runner.cc ('k') | sky/tools/webkitpy/layout_tests/port/base.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/tools/tester/tester.cc
diff --git a/sky/tools/tester/tester.cc b/sky/tools/tester/tester.cc
index 19f0db8362844e2039593c88183b57a3274debc8..4ee889ee06f53e25a1cce7680840aea73e34ed99 100644
--- a/sky/tools/tester/tester.cc
+++ b/sky/tools/tester/tester.cc
@@ -23,10 +23,32 @@ namespace sky {
namespace tester {
namespace {
-std::string WaitForURL() {
+struct UrlData {
std::string url;
- std::cin >> url;
- return url;
+ std::string expected_pixel_hash;
+ bool enable_pixel_dumping = false;
+};
+
+void WaitForURL(UrlData& data) {
+ // A test name is formated like file:///path/to/test'--pixel-test'pixelhash
+ std::cin >> data.url;
+
+ std::string pixel_switch;
+ std::string::size_type separator_position = data.url.find('\'');
+ if (separator_position != std::string::npos) {
+ pixel_switch = data.url.substr(separator_position + 1);
+ data.url.erase(separator_position);
+ }
+
+ std::string pixel_hash;
+ separator_position = pixel_switch.find('\'');
+ if (separator_position != std::string::npos) {
+ pixel_hash = pixel_switch.substr(separator_position + 1);
+ pixel_switch.erase(separator_position);
+ }
+
+ data.enable_pixel_dumping = pixel_switch == "--pixel-test";
+ data.expected_pixel_hash = pixel_hash;
}
} // namespace
@@ -110,8 +132,16 @@ class SkyTester : public mojo::ApplicationDelegate,
void Run() {
DCHECK(!test_runner_);
- std::string url = url_from_args_.length() ? url_from_args_ : WaitForURL();
- test_runner_.reset(new TestRunner(this, content_, url));
+
+ UrlData data;
+ if (url_from_args_.length()) {
+ data.url = url_from_args_;
+ } else {
+ WaitForURL(data);
+ }
+
+ test_runner_.reset(new TestRunner(this, content_, data.url,
+ data.enable_pixel_dumping));
}
void OnTestComplete() override {
« no previous file with comments | « sky/tools/tester/test_runner.cc ('k') | sky/tools/webkitpy/layout_tests/port/base.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698