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

Unified Diff: content/public/test/browser_test_utils.cc

Issue 10916334: Enable webgl conformance tests under content/test/gpu in content_browsertests (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: namespace fixup Created 8 years, 3 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 | « content/public/test/browser_test_utils.h ('k') | content/test/data/gpu/webgl_conformance.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/browser_test_utils.cc
diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc
index f49ce9219f9c43afb21de1d4167af04b55f853a4..f6b9361c2f7d1a16db976294a11f3c4799c078cd 100644
--- a/content/public/test/browser_test_utils.cc
+++ b/content/public/test/browser_test_utils.cc
@@ -17,6 +17,7 @@
#include "content/public/browser/browser_context.h"
#include "content/public/browser/dom_operation_notification_details.h"
#include "content/public/browser/notification_types.h"
+#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
@@ -569,4 +570,42 @@ TestWebSocketServer::~TestWebSocketServer() {
#endif
}
+DOMMessageQueue::DOMMessageQueue() : waiting_for_message_(false) {
+ registrar_.Add(this, NOTIFICATION_DOM_OPERATION_RESPONSE,
+ NotificationService::AllSources());
+}
+
+DOMMessageQueue::~DOMMessageQueue() {}
+
+void DOMMessageQueue::Observe(int type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ Details<DomOperationNotificationDetails> dom_op_details(details);
+ Source<RenderViewHost> sender(source);
+ message_queue_.push(dom_op_details->json);
+ if (waiting_for_message_) {
+ waiting_for_message_ = false;
+ message_loop_runner_->Quit();
+ }
+}
+
+void DOMMessageQueue::ClearQueue() {
+ message_queue_ = std::queue<std::string>();
+}
+
+bool DOMMessageQueue::WaitForMessage(std::string* message) {
+ if (message_queue_.empty()) {
+ waiting_for_message_ = true;
+ // This will be quit when a new message comes in.
+ message_loop_runner_ = new MessageLoopRunner;
+ message_loop_runner_->Run();
+ }
+ // The queue should not be empty, unless we were quit because of a timeout.
+ if (message_queue_.empty())
+ return false;
+ if (message)
+ *message = message_queue_.front();
+ return true;
+}
+
} // namespace content
« no previous file with comments | « content/public/test/browser_test_utils.h ('k') | content/test/data/gpu/webgl_conformance.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698