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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/public/test/browser_test_utils.h" 5 #include "content/public/test/browser_test_utils.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
11 #include "base/rand_util.h" 11 #include "base/rand_util.h"
12 #include "base/string_number_conversions.h" 12 #include "base/string_number_conversions.h"
13 #include "base/synchronization/waitable_event.h" 13 #include "base/synchronization/waitable_event.h"
14 #include "base/test/test_timeouts.h" 14 #include "base/test/test_timeouts.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "net/base/net_util.h" 16 #include "net/base/net_util.h"
17 #include "content/public/browser/browser_context.h" 17 #include "content/public/browser/browser_context.h"
18 #include "content/public/browser/dom_operation_notification_details.h" 18 #include "content/public/browser/dom_operation_notification_details.h"
19 #include "content/public/browser/notification_types.h" 19 #include "content/public/browser/notification_types.h"
20 #include "content/public/browser/notification_service.h"
20 #include "content/public/browser/render_process_host.h" 21 #include "content/public/browser/render_process_host.h"
21 #include "content/public/browser/render_view_host.h" 22 #include "content/public/browser/render_view_host.h"
22 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
23 #include "content/public/browser/web_contents_observer.h" 24 #include "content/public/browser/web_contents_observer.h"
24 #include "content/public/browser/web_contents_view.h" 25 #include "content/public/browser/web_contents_view.h"
25 #include "content/public/test/test_utils.h" 26 #include "content/public/test/test_utils.h"
26 #include "net/cookies/cookie_store.h" 27 #include "net/cookies/cookie_store.h"
27 #include "net/test/python_utils.h" 28 #include "net/test/python_utils.h"
28 #include "net/url_request/url_request_context.h" 29 #include "net/url_request/url_request_context.h"
29 #include "net/url_request/url_request_context_getter.h" 30 #include "net/url_request/url_request_context_getter.h"
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 options.wait = true; 563 options.wait = true;
563 base::LaunchProcess(*cmd_line.get(), options, NULL); 564 base::LaunchProcess(*cmd_line.get(), options, NULL);
564 565
565 #if defined(OS_POSIX) 566 #if defined(OS_POSIX)
566 // Just to make sure that the server process terminates certainly. 567 // Just to make sure that the server process terminates certainly.
567 if (process_group_id_ != base::kNullProcessHandle) 568 if (process_group_id_ != base::kNullProcessHandle)
568 base::KillProcessGroup(process_group_id_); 569 base::KillProcessGroup(process_group_id_);
569 #endif 570 #endif
570 } 571 }
571 572
573 DOMMessageQueue::DOMMessageQueue() : waiting_for_message_(false) {
574 registrar_.Add(this, NOTIFICATION_DOM_OPERATION_RESPONSE,
575 NotificationService::AllSources());
576 }
577
578 DOMMessageQueue::~DOMMessageQueue() {}
579
580 void DOMMessageQueue::Observe(int type,
581 const NotificationSource& source,
582 const NotificationDetails& details) {
583 Details<DomOperationNotificationDetails> dom_op_details(details);
584 Source<RenderViewHost> sender(source);
585 message_queue_.push(dom_op_details->json);
586 if (waiting_for_message_) {
587 waiting_for_message_ = false;
588 message_loop_runner_->Quit();
589 }
590 }
591
592 void DOMMessageQueue::ClearQueue() {
593 message_queue_ = std::queue<std::string>();
594 }
595
596 bool DOMMessageQueue::WaitForMessage(std::string* message) {
597 if (message_queue_.empty()) {
598 waiting_for_message_ = true;
599 // This will be quit when a new message comes in.
600 message_loop_runner_ = new MessageLoopRunner;
601 message_loop_runner_->Run();
602 }
603 // The queue should not be empty, unless we were quit because of a timeout.
604 if (message_queue_.empty())
605 return false;
606 if (message)
607 *message = message_queue_.front();
608 return true;
609 }
610
572 } // namespace content 611 } // namespace content
OLDNEW
« 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