summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/signaling_task.h28
-rw-r--r--chrome/test/testing_profile.cc9
-rw-r--r--chrome/test/testing_profile.h6
3 files changed, 43 insertions, 0 deletions
diff --git a/chrome/test/signaling_task.h b/chrome/test/signaling_task.h
new file mode 100644
index 0000000..23063e1
--- /dev/null
+++ b/chrome/test/signaling_task.h
@@ -0,0 +1,28 @@
+// Copyright (c) 2010 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.
+
+// A simple callback that you can use to wait for events on a thread.
+
+#ifndef CHROME_TEST_SIGNALING_TASK_H_
+#define CHROME_TEST_SIGNALING_TASK_H_
+#pragma once
+
+#include "base/waitable_event.h"
+
+using base::WaitableEvent;
+
+class SignalingTask : public Task {
+ public:
+ explicit SignalingTask(WaitableEvent* event) : event_(event) {
+ }
+
+ virtual void Run() {
+ event_->Signal();
+ }
+
+ private:
+ WaitableEvent* event_;
+};
+
+#endif // CHROME_TEST_SIGNALING_TASK_H_
diff --git a/chrome/test/testing_profile.cc b/chrome/test/testing_profile.cc
index e0a3968..6292079 100644
--- a/chrome/test/testing_profile.cc
+++ b/chrome/test/testing_profile.cc
@@ -169,6 +169,15 @@ TestingProfile::TestingProfile(int count)
file_util::CreateDirectory(path_);
}
+TestingProfile::TestingProfile(const FilePath& path)
+ : start_time_(Time::Now()),
+ created_theme_provider_(false),
+ has_history_service_(false),
+ off_the_record_(false),
+ last_session_exited_cleanly_(true) {
+ path_ = path;
+}
+
TestingProfile::~TestingProfile() {
NotificationService::current()->Notify(
NotificationType::PROFILE_DESTROYED,
diff --git a/chrome/test/testing_profile.h b/chrome/test/testing_profile.h
index ee4b601..1e39f8a 100644
--- a/chrome/test/testing_profile.h
+++ b/chrome/test/testing_profile.h
@@ -45,6 +45,12 @@ class TestingProfile : public Profile {
// time.
explicit TestingProfile(int count);
+ // Creates a new profile specifying the target directory.
+ // Use this as a temporary solution for tests requiring a ScopedTempDir.
+ // This directory must already exist.
+ // TODO(chron): Use a ScopedTempDir. Remove constructor. BUG=51833
+ explicit TestingProfile(const FilePath& directory);
+
virtual ~TestingProfile();
// Creates the favicon service. Consequent calls would recreate the service.