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

Unified Diff: chrome/browser/extensions/api/automation/automation_apitest.cc

Issue 1155183006: Reimplement automation API on top of C++-backed AXTree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@automation_faster_2
Patch Set: Rebase, delete some code that shouldn't have been commented out Created 5 years, 6 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/browser/extensions/api/automation/automation_apitest.cc
diff --git a/chrome/browser/extensions/api/automation/automation_apitest.cc b/chrome/browser/extensions/api/automation/automation_apitest.cc
index cf8cc1df722e63a69714499975324d1d5f1384f8..80239f1d9b88e7ce3a712f28fc43ee180ff42373 100644
--- a/chrome/browser/extensions/api/automation/automation_apitest.cc
+++ b/chrome/browser/extensions/api/automation/automation_apitest.cc
@@ -5,13 +5,15 @@
#include "base/files/file_path.h"
#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
-#include "chrome/browser/extensions/api/automation_internal/automation_util.h"
+#include "chrome/browser/accessibility/ax_tree_id_registry.h"
+#include "chrome/browser/extensions/api/automation_internal/automation_event_router.h"
#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/api/automation_internal.h"
+#include "chrome/common/extensions/chrome_extension_messages.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/ax_event_notification_details.h"
#include "content/public/browser/render_widget_host.h"
@@ -96,11 +98,6 @@ IN_PROC_BROWSER_TEST_F(AutomationApiTest, SanityCheck) {
<< message_;
}
-IN_PROC_BROWSER_TEST_F(AutomationApiTest, Unit) {
- ASSERT_TRUE(RunExtensionSubtest("automation/tests/unit", "unit.html"))
- << message_;
-}
-
IN_PROC_BROWSER_TEST_F(AutomationApiTest, GetTreeByTabId) {
StartEmbeddedTestServer();
ASSERT_TRUE(RunExtensionSubtest("automation/tests/tabs", "tab_id.html"))
@@ -200,10 +197,9 @@ IN_PROC_BROWSER_TEST_F(AutomationApiTest, Find) {
<< message_;
}
-// Flaky. http://crbug.com/467921
-IN_PROC_BROWSER_TEST_F(AutomationApiTest, DISABLED_Mixins) {
+IN_PROC_BROWSER_TEST_F(AutomationApiTest, Attributes) {
StartEmbeddedTestServer();
- ASSERT_TRUE(RunExtensionSubtest("automation/tests/tabs", "mixins.html"))
+ ASSERT_TRUE(RunExtensionSubtest("automation/tests/tabs", "attributes.html"))
<< message_;
}
@@ -271,23 +267,25 @@ class TreeSerializationState {
int node_id,
int routing_id,
BrowserContext* browser_context) {
- content::AXEventNotificationDetails detail(update.node_id_to_clear,
- update.nodes,
- event,
- node_id,
- kPid,
- routing_id);
- std::vector<content::AXEventNotificationDetails> details;
- details.push_back(detail);
- automation_util::DispatchAccessibilityEventsToAutomation(
- details, browser_context, gfx::Vector2d());
+ ExtensionMsg_AccessibilityEventParams params;
+ params.tree_id = AXTreeIDRegistry::GetInstance()->GetOrCreateAXTreeID(
+ kPid, routing_id);
+ params.id = node_id;
+ params.event_type = event;
+ params.update = update;
+ AutomationEventRouter* router = AutomationEventRouter::GetInstance();
+ router->DispatchAccessibilityEvent(params);
}
// Notify the extension bindings to destroy the tree for the given tab
// (identified by routing_id)
void SendTreeDestroyedEvent(int routing_id, BrowserContext* browser_context) {
- automation_util::DispatchTreeDestroyedEventToAutomation(
- kPid, routing_id, browser_context);
+ int tree_id = AXTreeIDRegistry::GetInstance()->GetOrCreateAXTreeID(
David Tseng 2015/06/10 15:56:31 Is this code (and the generated tree test) obsolet
dmazzoni 2015/06/11 19:09:11 You're right, deleted.
+ kPid, routing_id);
+ AXTreeIDRegistry::GetInstance()->RemoveAXTreeID(tree_id);
+
+ AutomationEventRouter* router = AutomationEventRouter::GetInstance();
+ router->DispatchTreeDestroyedEvent(tree_id, browser_context);
}
// Reset tree0 to a new generated tree based on tree0_version, reset

Powered by Google App Engine
This is Rietveld 408576698