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

Unified Diff: ui/ozone/platform/test/test_window_manager.cc

Issue 419993003: Adds a do-nothing ozone platform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adds a do-nothing ozone platform when --ozone-dump-file is not specified 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 side-by-side diff with in-line comments
Download patch
Index: ui/ozone/platform/test/test_window_manager.cc
diff --git a/ui/ozone/platform/test/test_window_manager.cc b/ui/ozone/platform/test/test_window_manager.cc
index 8e6e4b02b1a0e3640618e9d1ff03e3b2fdcfa193..e84297c3ea884b89aa4c68164132004dd8bd212d 100644
--- a/ui/ozone/platform/test/test_window_manager.cc
+++ b/ui/ozone/platform/test/test_window_manager.cc
@@ -21,6 +21,7 @@ namespace ui {
namespace {
void WriteDataToFile(const base::FilePath& location, const SkBitmap& bitmap) {
+ DCHECK(!location.empty());
std::vector<unsigned char> png_data;
gfx::PNGCodec::FastEncodeBGRASkBitmap(bitmap, true, &png_data);
base::WriteFile(location,
@@ -42,6 +43,8 @@ class FileSurface : public SurfaceOzoneCanvas {
return skia::SharePtr(surface_->getCanvas());
}
virtual void PresentCanvas(const gfx::Rect& damage) OVERRIDE {
+ if (location_.empty())
+ return;
SkBitmap bitmap;
bitmap.setInfo(surface_->getCanvas()->imageInfo());
@@ -71,6 +74,8 @@ TestWindowManager::~TestWindowManager() {
}
void TestWindowManager::Initialize() {
+ if (location_.empty())
+ return;
if (!DirectoryExists(location_) && !base::CreateDirectory(location_) &&
location_ != base::FilePath("/dev/null"))
PLOG(FATAL) << "unable to create output directory";
@@ -79,10 +84,14 @@ void TestWindowManager::Initialize() {
}
int32_t TestWindowManager::AddWindow(TestWindow* window) {
+ if (location_.empty())
+ return 1;
return windows_.Add(window);
}
void TestWindowManager::RemoveWindow(int32_t window_id, TestWindow* window) {
+ if (location_.empty())
+ return;
DCHECK_EQ(window, windows_.Lookup(window_id));
windows_.Remove(window_id);
}
@@ -93,6 +102,10 @@ base::FilePath TestWindowManager::base_path() const {
scoped_ptr<SurfaceOzoneCanvas> TestWindowManager::CreateCanvasForWidget(
gfx::AcceleratedWidget widget) {
+ if (location_.empty()) {
dnicoara 2014/07/31 02:51:31 There is no reason to complicate the code with the
spang 2014/07/31 16:04:01 I think we need the one in Initialize() and in Pre
dnicoara 2014/07/31 16:09:23 The one in CreateCanvasForWidget shouldn't be need
varkha 2014/08/07 00:17:10 Acknowledged.
varkha 2014/08/07 00:17:10 Done.
varkha 2014/08/07 00:17:11 Done.
+ return make_scoped_ptr<SurfaceOzoneCanvas>(
+ new FileSurface(base::FilePath()));
+ }
TestWindow* window = windows_.Lookup(widget);
DCHECK(window);
return make_scoped_ptr<SurfaceOzoneCanvas>(new FileSurface(window->path()));
« ui/ozone/platform/test/test_window.cc ('K') | « ui/ozone/platform/test/test_window.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698