Chromium Code Reviews| Index: sky/tools/tester/tester.cc |
| diff --git a/sky/tools/tester/tester.cc b/sky/tools/tester/tester.cc |
| index 19f0db8362844e2039593c88183b57a3274debc8..3c94b47281de6267778115982c90b26fe9e84405 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() { |
| - std::string url; |
| - std::cin >> url; |
| - return url; |
| +std::string WaitForURL(bool* enable_pixel_dumping, |
|
ojan
2014/12/12 03:48:39
This code is cargo-culted from https://code.google
|
| + std::string* expected_pixel_hash) { |
| + // A test name is formated like file:///path/to/test'--pixel-test'pixelhash |
| + std::string test_name; |
| + std::cin >> test_name; |
| + |
| + std::string pixel_switch; |
| + std::string::size_type separator_position = test_name.find('\''); |
| + if (separator_position != std::string::npos) { |
| + pixel_switch = test_name.substr(separator_position + 1); |
| + test_name.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); |
| + } |
| + |
| + if (enable_pixel_dumping) |
| + *enable_pixel_dumping = pixel_switch == "--pixel-test"; |
| + if (expected_pixel_hash) |
| + *expected_pixel_hash = pixel_hash; |
| + |
| + return test_name; |
| } |
| } // namespace |
| @@ -110,8 +132,12 @@ 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)); |
| + |
| + bool enable_pixel_dumping = false; |
| + std::string expected_pixel_hash; |
|
ojan
2014/12/12 03:48:39
This is unused at the moment, but we will need it
|
| + |
| + std::string url = url_from_args_.length() ? url_from_args_ : WaitForURL(&enable_pixel_dumping, &expected_pixel_hash); |
| + test_runner_.reset(new TestRunner(this, content_, url, enable_pixel_dumping)); |
| } |
| void OnTestComplete() override { |