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

Side by Side Diff: chrome/browser/chromeos/login/screenshot_tester.h

Issue 405093003: Taking screenshots while running a test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added comments for ScreenshotTester fields & fixed some minor style bugs Created 6 years, 5 months 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 unified diff | Download patch
OLDNEW
(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
Denis Kuznetsov (DE-MUC) 2014/07/21 14:25:33 namespace chromeos here and in .cc file
Lisa Ignatyeva 2014/07/21 14:40:50 Done.
16 // A class that allows taking, saving and comparing screnshots while
17 // running tests.
18 class ScreenshotTester {
19 public:
20 ScreenshotTester();
21 virtual ~ScreenshotTester();
22
23 // Returns true if the screenshots should be taken and will be taken,
24 // false otherwise. Also gets all the information from the command line
25 // swithes.
26 bool TryInitialize();
27
28 // Does all the work that has been stated through switches:
29 // updates golden screenshot or takes a new screenshot and compares it
30 // with the golden one (this part is not implemented yet).
31 void Run(const std::string& file_name);
32
33 private:
34 typedef scoped_refptr<base::RefCountedBytes> PNGFile;
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.
41 void ReturnScreenshot(PNGFile png_data);
42
43 // Path to the directory for golden screenshots.
44 base::FilePath screenshot_dest_;
45
46 // Full path to a golden screenshot for the test
47 // from which ScreenshotTester.Run() was called
48 base::FilePath golden_screenshot_path_;
49
50 // |run_loop_| and |run_loop_quitter_| are used to synchronize
51 // with ui::GrabWindowSnapshotAsync.
52 base::RunLoop run_loop_;
53 base::Closure run_loop_quitter_;
54
55 // Current screenshot.
56 PNGFile screenshot_;
57
58 // Is true when we running updating golden screenshots mode.
59 bool update_golden_screenshot_;
60 base::WeakPtrFactory<ScreenshotTester> weak_factory_;
61
62 DISALLOW_COPY_AND_ASSIGN(ScreenshotTester);
63 };
64
65 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/login_ui_browsertest.cc ('k') | chrome/browser/chromeos/login/screenshot_tester.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698