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

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: directory change and remove duplicate code 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
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..c16d2c3b9b63e99b1aeac0d48e5129095aa877d8 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, content::NOTIFICATION_DOM_OPERATION_RESPONSE,
jam 2012/09/24 16:45:37 ditto
+ content::NotificationService::AllSources());
+}
+
+DOMMessageQueue::~DOMMessageQueue() {}
+
+void DOMMessageQueue::Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
+ content::Details<DomOperationNotificationDetails> dom_op_details(details);
+ content::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 content::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

Powered by Google App Engine
This is Rietveld 408576698