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

Side by Side Diff: chrome/browser/chromeos/login/screenshot_testing/screenshot_tester.cc

Issue 1049873005: [chrome/browser/chromeos/] favor DCHECK_CURRENTLY_ON for better logs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/login/screenshot_testing/screenshot_tester.h" 5 #include "chrome/browser/chromeos/login/screenshot_testing/screenshot_tester.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "chrome/browser/chromeos/login/screenshot_testing/SkDiffPixelsMetric.h" 10 #include "chrome/browser/chromeos/login/screenshot_testing/SkDiffPixelsMetric.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 196
197 void ScreenshotTester::ReturnScreenshot(const PNGFile& screenshot, 197 void ScreenshotTester::ReturnScreenshot(const PNGFile& screenshot,
198 PNGFile png_data) { 198 PNGFile png_data) {
199 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 199 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
200 screenshot->data() = png_data->data(); 200 screenshot->data() = png_data->data();
201 content::BrowserThread::PostTask( 201 content::BrowserThread::PostTask(
202 content::BrowserThread::UI, FROM_HERE, run_loop_quitter_); 202 content::BrowserThread::UI, FROM_HERE, run_loop_quitter_);
203 } 203 }
204 204
205 ScreenshotTester::PNGFile ScreenshotTester::TakeScreenshot() { 205 ScreenshotTester::PNGFile ScreenshotTester::TakeScreenshot() {
206 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 206 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
207 aura::Window* primary_window = ash::Shell::GetPrimaryRootWindow(); 207 aura::Window* primary_window = ash::Shell::GetPrimaryRootWindow();
208 gfx::Rect rect = primary_window->bounds(); 208 gfx::Rect rect = primary_window->bounds();
209 PNGFile screenshot = new base::RefCountedBytes; 209 PNGFile screenshot = new base::RefCountedBytes;
210 ui::GrabWindowSnapshotAsync(primary_window, 210 ui::GrabWindowSnapshotAsync(primary_window,
211 rect, 211 rect,
212 content::BrowserThread::GetBlockingPool(), 212 content::BrowserThread::GetBlockingPool(),
213 base::Bind(&ScreenshotTester::ReturnScreenshot, 213 base::Bind(&ScreenshotTester::ReturnScreenshot,
214 weak_factory_.GetWeakPtr(), 214 weak_factory_.GetWeakPtr(),
215 screenshot)); 215 screenshot));
216 base::RunLoop run_loop; 216 base::RunLoop run_loop;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 343
344 ScreenshotTester::Result testing_result; 344 ScreenshotTester::Result testing_result;
345 testing_result.similarity = result.result; 345 testing_result.similarity = result.result;
346 testing_result.screenshots_match = 346 testing_result.screenshots_match =
347 (result.result == SkImageDiffer::RESULT_CORRECT); 347 (result.result == SkImageDiffer::RESULT_CORRECT);
348 348
349 return testing_result; 349 return testing_result;
350 } 350 }
351 351
352 } // namespace chromeos 352 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/screens/network_screen.cc ('k') | chrome/browser/chromeos/login/session/user_session_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698