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

Unified Diff: chrome/test/webdriver/webdriver_basic_types.h

Issue 7522024: Refactor chromedriver's script execution to reduce amount of custom Value parsing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 9 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: chrome/test/webdriver/webdriver_basic_types.h
diff --git a/chrome/test/webdriver/webdriver_basic_types.h b/chrome/test/webdriver/webdriver_basic_types.h
new file mode 100644
index 0000000000000000000000000000000000000000..03bfbab209556c89808a75278e180fc5fde7a111
--- /dev/null
+++ b/chrome/test/webdriver/webdriver_basic_types.h
@@ -0,0 +1,87 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_TEST_WEBDRIVER_WEBDRIVER_BASIC_TYPES_H_
+#define CHROME_TEST_WEBDRIVER_WEBDRIVER_BASIC_TYPES_H_
+#pragma once
+
+#include "chrome/test/automation/value_conversion_traits.h"
+
+namespace base {
+class Value;
+}
+
+namespace webdriver {
+
+class Point {
+ public:
+ Point();
+ Point(double x, double y);
+ ~Point();
+
+ void Offset(double x, double y);
+
+ double x() const;
+ double y() const;
+
+ private:
+ double x_, y_;
+};
+
+class Size {
+ public:
+ Size();
+ Size(double width, double height);
+ ~Size();
+
+ double width() const;
+ double height() const;
+
+ private:
+ double width_, height_;
+};
+
+class Rect {
+ public:
+ Rect();
+ Rect(double x, double y, double width, double height);
+ Rect(const Point& origin, const Size& size);
+ ~Rect();
+
+ const Point& origin() const;
+ const Size& size() const;
+ double x() const;
+ double y() const;
+ double width() const;
+ double height() const;
+
+ private:
+ Point origin_;
+ Size size_;
+};
+
+} // namespace webdriver
+
+template <>
+struct ValueConversionTraits<webdriver::Point> {
+ static base::Value* CreateValueFrom(const webdriver::Point& t);
+ static bool SetFromValue(const base::Value* value, webdriver::Point* t);
+ static bool CanConvert(const base::Value* value);
+};
+
+template <>
+struct ValueConversionTraits<webdriver::Size> {
+ static base::Value* CreateValueFrom(const webdriver::Size& t);
+ static bool SetFromValue(const base::Value* value, webdriver::Size* t);
+ static bool CanConvert(const base::Value* value);
+};
+
+template <>
+struct ValueConversionTraits<webdriver::Rect> {
+ static base::Value* CreateValueFrom(const webdriver::Rect& t);
+ static bool SetFromValue(const base::Value* value, webdriver::Rect* t);
+ static bool CanConvert(const base::Value* value);
+};
+
+#endif // CHROME_TEST_WEBDRIVER_WEBDRIVER_BASIC_TYPES_H_

Powered by Google App Engine
This is Rietveld 408576698