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

Unified Diff: chrome/test/base/accessibility_test_helper.h

Issue 582493002: Enable accessibility testing for the bookmark browser test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update for Review Created 5 years, 11 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/base/accessibility_test_helper.h
diff --git a/chrome/test/base/accessibility_test_helper.h b/chrome/test/base/accessibility_test_helper.h
new file mode 100644
index 0000000000000000000000000000000000000000..22c9312fab4ee8b79115e52d1400256fc56a817a
--- /dev/null
+++ b/chrome/test/base/accessibility_test_helper.h
@@ -0,0 +1,52 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
Paweł Hajdan Jr. 2015/01/29 13:01:19 nit: 2015
hcarmona 2015/01/30 22:19:47 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_TEST_BASE_ACCESSIBILITY_TEST_HELPER_H_
+#define CHROME_TEST_BASE_ACCESSIBILITY_TEST_HELPER_H_
+
+#include <string>
+
+#include "content/public/browser/render_frame_host.h"
+#include "content/public/browser/web_contents.h"
+
+/*
+ * This class will allow any browser test to run the accessibility tests.
+ * The TearDownOnMainThread method is probably the best place to use this class
+ * because it will apply to all test cases, but it can be run on select cases by
+ * using it in the test method.
+ */
+
+class AccessibilityTestHelper {
+ public:
+ // These are the expected results of an accessibility test.
+ static const std::string kExpectedResults;
+
+ // This is the script that will run the accessibility test.
+ static const std::string kAccessibilityTestString;
+
+ // This method loads the javascript accessibility library.
+ // Returns false on loading error. Test will fail if library is not loaded.
+ bool LoadLibrary(content::WebContents* web_contents);
Paweł Hajdan Jr. 2015/01/29 13:01:19 nit: Please use WARN_UNUSED_RESULT, applies to oth
hcarmona 2015/01/30 22:19:47 Done.
+
+ // Should be called after loading libraries. Load method is separate to allow
+ // better error reporting. This method returns true if test was run,
+ // regardless of result. Return value of false means we were not able to test
+ // for accessibility.
+ bool RunAccessibilityTest(content::RenderFrameHost* focused_frame);
+
+ // Get the results of an accessibility test.
+ // This should be compared to kExpectedResults
+ std::string accessibility_message();
Paweł Hajdan Jr. 2015/01/29 13:01:18 nit: If this is not inline (why?) it should not be
hcarmona 2015/01/30 22:19:47 Done.
+
+ private:
+ // Holds the results of an accessibility test.
+ std::string accessibility_message_;
Paweł Hajdan Jr. 2015/01/29 13:01:19 Is this member variable the only reason for making
hcarmona 2015/01/30 22:19:47 That makes sense. I've moved these functions into
+
+ // This should be used to load libraries.
+ // All library paths should be relative to the source root.
+ bool LoadScript(content::WebContents* web_contents, base::FilePath path);
+};
+
+#endif // CHROME_TEST_BASE_ACCESSIBILITY_TEST_HELPER_H_
+

Powered by Google App Engine
This is Rietveld 408576698