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

Unified Diff: chrome/test/base/javascript_test_observer.cc

Issue 286243003: Move JavascriptTestObserver from chrome to content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unnecessary content prefixes Created 6 years, 7 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 | « chrome/test/base/javascript_test_observer.h ('k') | chrome/test/nacl/nacl_browsertest_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/base/javascript_test_observer.cc
diff --git a/chrome/test/base/javascript_test_observer.cc b/chrome/test/base/javascript_test_observer.cc
deleted file mode 100644
index d010b93dcfae86216108c1135e0b2ea953e3ccfd..0000000000000000000000000000000000000000
--- a/chrome/test/base/javascript_test_observer.cc
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/test/base/javascript_test_observer.h"
-
-#include "content/public/browser/dom_operation_notification_details.h"
-#include "content/public/browser/notification_types.h"
-#include "content/public/browser/render_view_host.h"
-#include "content/public/browser/web_contents.h"
-#include "content/public/test/test_utils.h"
-
-TestMessageHandler::TestMessageHandler() : ok_(true) {
-}
-
-TestMessageHandler::~TestMessageHandler() {
-}
-
-void TestMessageHandler::SetError(const std::string& message) {
- ok_ = false;
- error_message_ = message;
-}
-
-void TestMessageHandler::Reset() {
- ok_ = true;
- error_message_.clear();
-}
-
-JavascriptTestObserver::JavascriptTestObserver(
- content::WebContents* web_contents,
- TestMessageHandler* handler)
- : handler_(handler),
- running_(false),
- finished_(false) {
- Reset();
- registrar_.Add(this,
- content::NOTIFICATION_DOM_OPERATION_RESPONSE,
- content::Source<content::WebContents>(web_contents));
-}
-
-JavascriptTestObserver::~JavascriptTestObserver() {
-}
-
-bool JavascriptTestObserver::Run() {
- // Messages may have arrived before Run was called.
- if (!finished_) {
- CHECK(!running_);
- running_ = true;
- content::RunMessageLoop();
- running_ = false;
- }
- return handler_->ok();
-}
-
-void JavascriptTestObserver::Reset() {
- CHECK(!running_);
- running_ = false;
- finished_ = false;
- handler_->Reset();
-}
-
-void JavascriptTestObserver::Observe(
- int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- CHECK(type == content::NOTIFICATION_DOM_OPERATION_RESPONSE);
- content::Details<content::DomOperationNotificationDetails> dom_op_details(
- details);
- // We might receive responses for other script execution, but we only
- // care about the test finished message.
- TestMessageHandler::MessageResponse response =
- handler_->HandleMessage(dom_op_details->json);
-
- if (response == TestMessageHandler::DONE) {
- EndTest();
- } else {
- Continue();
- }
-}
-
-void JavascriptTestObserver::Continue() {
-}
-
-void JavascriptTestObserver::EndTest() {
- finished_ = true;
- if (running_) {
- running_ = false;
- base::MessageLoopForUI::current()->Quit();
- }
-}
« no previous file with comments | « chrome/test/base/javascript_test_observer.h ('k') | chrome/test/nacl/nacl_browsertest_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698