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

Unified Diff: chrome_frame/test/chrome_frame_ui_test_utils.cc

Issue 3156026: Add a method for setting the value of an Accessibility object.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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
« no previous file with comments | « chrome_frame/test/chrome_frame_ui_test_utils.h ('k') | chrome_frame/test/mock_ie_event_sink_actions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome_frame/test/chrome_frame_ui_test_utils.cc
===================================================================
--- chrome_frame/test/chrome_frame_ui_test_utils.cc (revision 56373)
+++ chrome_frame/test/chrome_frame_ui_test_utils.cc (working copy)
@@ -13,6 +13,7 @@
#include "base/scoped_bstr_win.h"
#include "base/scoped_ptr.h"
#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
#include "gfx/rect.h"
#include "chrome_frame/test/win_event_receiver.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -53,6 +54,18 @@
}
// static
+AccObject* AccObject::CreateFromEvent(HWND hwnd, LONG object_id,
+ LONG child_id) {
+ ScopedComPtr<IAccessible> accessible;
+ ScopedVariant acc_child_id;
+ AccessibleObjectFromEvent(hwnd, object_id, child_id, accessible.Receive(),
+ acc_child_id.Receive());
+ if (accessible && acc_child_id.type() == VT_I4)
+ return new AccObject(accessible, V_I4(&acc_child_id));
+ return NULL;
+}
+
+// static
AccObject* AccObject::CreateFromDispatch(IDispatch* dispatch) {
if (dispatch) {
ScopedComPtr<IAccessible> accessible;
@@ -114,6 +127,22 @@
return did_select;
}
+bool AccObject::SetValue(const std::wstring& value) {
+ ScopedBstr value_bstr(value.c_str());
+ EXPECT_HRESULT_SUCCEEDED(accessible_->put_accValue(child_id_, value_bstr));
+
+ // Double check that the object's value has actually changed. Some objects'
+ // values can not be changed.
+ bool did_set_value = false;
+ std::wstring actual_value = L"-";
+ if (GetValue(&actual_value) && value == actual_value) {
+ did_set_value = true;
+ }
+ EXPECT_TRUE(did_set_value) << "Could not set value for AccObject: "
+ << GetDescription();
+ return did_set_value;
+}
+
bool AccObject::GetName(std::wstring* name) {
DCHECK(name);
ScopedBstr name_bstr;
@@ -233,9 +262,12 @@
objects.push_back(new AccObject(accessible_, V_I4(&children[i])));
continue;
} else if (FAILED(result)) {
- LOG(ERROR) << "Failed to determine if child id refers to a full "
- << "object. Error: " << result;
- return false;
+ DLOG(WARNING) << "Failed to determine if child id refers to a full "
+ << "object. Error: " << result << std::endl
+ << "Parent object: " << WideToUTF8(GetDescription())
+ << std::endl << "Child ID: " << V_I4(&children[i]);
+ // Disregard this object.
+ continue;
}
// The object in question was actually a full object. It is saved in the
// |dispatch| arg and will be added down below.
@@ -400,9 +432,9 @@
scoped_refptr<AccObject>* object) {
DCHECK(object);
EXPECT_TRUE(matcher.FindInWindow(hwnd, object));
- EXPECT_TRUE(object) << "Element not found for matcher: "
+ EXPECT_TRUE(*object) << "Element not found for matcher: "
<< matcher.GetDescription();
- if (!object)
+ if (!*object)
DumpAccessibilityTreeForWindow(hwnd);
return *object;
}
« no previous file with comments | « chrome_frame/test/chrome_frame_ui_test_utils.h ('k') | chrome_frame/test/mock_ie_event_sink_actions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698