Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTER_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTER_H_ | |
| 7 | |
| 8 #include "base/base_export.h" | |
| 9 #include "base/bind_internal.h" | |
| 10 #include "base/files/file_path.h" | |
| 11 #include "base/macros.h" | |
| 12 #include "base/memory/ref_counted_memory.h" | |
| 13 #include "base/memory/weak_ptr.h" | |
| 14 #include "base/run_loop.h" | |
| 15 | |
| 16 // A class that allows taking, saving and comparing screnshots while | |
| 17 // running tests. | |
| 18 class ScreenshotTester { | |
| 19 public: | |
| 20 typedef scoped_refptr<base::RefCountedBytes> PNGFile; | |
|
Denis Kuznetsov (DE-MUC)
2014/07/21 13:49:43
This is used only in private section. Move typedef
Lisa Ignatyeva
2014/07/21 14:07:04
Done.
| |
| 21 ScreenshotTester(); | |
| 22 virtual ~ScreenshotTester(); | |
| 23 | |
| 24 // Returns true if the screenshots should be taken and will be taken, | |
| 25 // false otherwise. Also gets all the information from the command line | |
| 26 // swithes. | |
| 27 bool TryInitialize(); | |
| 28 | |
| 29 // Does all the work that has been stated through switches: | |
| 30 // updates golden screenshot or takes a new screenshot and compares it | |
| 31 // with the golden one (this part is not implemented yet). | |
| 32 void Run(const std::string& file_name); | |
| 33 | |
| 34 private: | |
| 35 void TakeScreenshot(); | |
| 36 | |
| 37 // Saves |png_data| as a new golden screenshot for this test. | |
| 38 void UpdateGoldenScreenshot(PNGFile png_data); | |
| 39 | |
| 40 // Saves |png_data" as a current screenshot. | |
|
Denis Kuznetsov (DE-MUC)
2014/07/21 13:49:43
nit: fix typo
Lisa Ignatyeva
2014/07/21 14:07:04
Done.
| |
| 41 void ReturnScreenshot(PNGFile png_data); | |
| 42 base::FilePath screenshot_dest_; | |
|
Denis Kuznetsov (DE-MUC)
2014/07/21 13:49:43
Extra line between methods and fields.
Some commen
Lisa Ignatyeva
2014/07/21 14:07:04
Done.
| |
| 43 base::FilePath golden_screenshot_path_; | |
| 44 base::RunLoop run_loop_; | |
| 45 base::Closure run_loop_quitter_; | |
| 46 PNGFile screenshot_; | |
| 47 base::WeakPtrFactory<ScreenshotTester> weak_factory_; | |
|
Denis Kuznetsov (DE-MUC)
2014/07/21 13:49:43
Move factory down - it should be last field, as Yu
Lisa Ignatyeva
2014/07/21 14:07:04
Done.
| |
| 48 bool update_golden_screenshot_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(ScreenshotTester); | |
| 51 }; | |
| 52 | |
| 53 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTER_H_ | |
| OLD | NEW |