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 "ash/shell.h" | |
ygorshenin1
2014/07/21 09:48:23
Could you please remove inclusions of modules whic
Lisa Ignatyeva
2014/07/21 13:41:03
Done.
| |
9 #include "base/base_export.h" | |
10 #include "base/bind_internal.h" | |
11 #include "base/memory/weak_ptr.h" | |
12 #include "base/prefs/pref_service.h" | |
13 #include "base/run_loop.h" | |
14 #include "chrome/browser/browser_process.h" | |
15 #include "chrome/browser/chromeos/login/login_manager_test.h" | |
16 #include "chrome/browser/chromeos/login/startup_utils.h" | |
17 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" | |
18 #include "chrome/browser/ui/ash/screenshot_taker.h" | |
19 #include "chrome/common/pref_names.h" | |
20 #include "content/public/browser/browser_thread.h" | |
21 #include "content/public/browser/notification_observer.h" | |
22 #include "content/public/browser/notification_registrar.h" | |
23 #include "ui/gfx/image/image.h" | |
24 #include "ui/snapshot/snapshot.h" | |
25 | |
26 typedef scoped_refptr<base::RefCountedBytes> PNGFile; | |
ygorshenin1
2014/07/21 09:48:23
Please, don't use typedef's in header files. You c
Lisa Ignatyeva
2014/07/21 13:41:04
Done.
| |
27 | |
28 // Key to turn on testing with screenshots | |
29 const char kEnableTestScreenshots[] = "enable-test-screenshots"; | |
30 // Key to specify directory where the screenshots will be saved. Only | |
31 // works if enable-test-screenshots is on. | |
32 const char kScreenshotDest[] = "screenshot-dest"; | |
ygorshenin1
2014/07/21 09:48:23
How about to rename the switch to "test-screenshot
Denis Kuznetsov (DE-MUC)
2014/07/21 12:13:17
I'd vote for including "destination" to switch nam
Lisa Ignatyeva
2014/07/21 13:41:03
Done.
| |
33 const char kUpdateGoldenScreenshots[] = "update-golden-screenshots"; | |
ygorshenin1
2014/07/21 09:48:23
How about to move all switches to chromeos/chromeo
Denis Kuznetsov (DE-MUC)
2014/07/21 12:13:17
Acknowledged.
Lisa Ignatyeva
2014/07/21 13:41:03
Done.
Lisa Ignatyeva
2014/07/21 13:41:04
Done.
| |
34 | |
35 // A class that allows taking, saving and comparing screnshots while | |
36 // running tests. | |
37 class ScreenshotTester { | |
38 public: | |
39 ScreenshotTester(); | |
40 virtual ~ScreenshotTester(); | |
41 | |
42 // Returns true if the screenshots should be taken and will be taken, | |
43 // false otherwise. Also gets all the information from the command line | |
44 // swithes. | |
45 bool TryInitialize(); | |
46 | |
47 // Does all the work that has been stated through switches: | |
48 // updates golden screenshot or takes a new screenshot and compares it | |
49 // with the golden one (this part is not implemented yet). | |
50 void Run(const std::string& file_name); | |
51 | |
52 base::WeakPtrFactory<ScreenshotTester> weak_factory_; | |
ygorshenin1
2014/07/21 09:48:23
Weak factory should be declared last in the class
Denis Kuznetsov (DE-MUC)
2014/07/21 12:13:17
Also, WeakFactory should be private.
Lisa Ignatyeva
2014/07/21 13:41:04
Done.
Lisa Ignatyeva
2014/07/21 13:41:04
Done.
Lisa Ignatyeva
2014/07/21 13:41:04
Done.
| |
53 | |
54 private: | |
55 bool update_golden_screenshot_; | |
ygorshenin1
2014/07/21 09:48:23
Please, reorder fields and methods according to ht
Lisa Ignatyeva
2014/07/21 13:41:03
Done.
| |
56 void TakeScreenshot(); | |
57 // Saves |png_data| as a new golden screenshot for this test. | |
ygorshenin1
2014/07/21 09:48:23
Could you please add blank lines before comments?
Lisa Ignatyeva
2014/07/21 13:41:04
Done.
| |
58 void UpdateGoldenScreenshot(PNGFile png_data); | |
59 // Saves |png_data" as a current screenshot. | |
60 void ReturnScreenshot(PNGFile png_data); | |
61 base::FilePath screenshot_dest_; | |
62 base::FilePath golden_screenshot_path; | |
ygorshenin1
2014/07/21 09:48:23
Class fields's names must be with an underscore at
Lisa Ignatyeva
2014/07/21 13:41:04
Done.
| |
63 base::RunLoop run_loop_; | |
64 base::Closure run_loop_quitter_; | |
65 PNGFile screenshot; | |
ygorshenin1
2014/07/21 09:48:23
Could you please rename "screenshot" to "screensho
ygorshenin1
2014/07/21 09:48:23
Add inclusion of "base/macros.h" and add DISALLOW_
Lisa Ignatyeva
2014/07/21 13:41:04
Done.
Lisa Ignatyeva
2014/07/21 13:41:04
Done.
| |
66 }; | |
ygorshenin1
2014/07/21 09:48:23
nit: insert a blank line after the class declarati
Lisa Ignatyeva
2014/07/21 13:41:04
Done.
| |
67 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTER_H_ | |
OLD | NEW |