summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/automation/automation_provider.cc2
-rw-r--r--chrome/browser/automation/automation_provider.h12
-rw-r--r--chrome/browser/automation/automation_provider_unittest.cc4
3 files changed, 14 insertions, 4 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index dbd31cb..41550d4 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -113,6 +113,8 @@ AutomationProvider::AutomationProvider(Profile* profile)
initial_loads_complete_(false) {
TRACE_EVENT_BEGIN("AutomationProvider::AutomationProvider", 0, "");
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
browser_tracker_.reset(new AutomationBrowserTracker(this));
extension_tracker_.reset(new AutomationExtensionTracker(this));
tab_tracker_.reset(new AutomationTabTracker(this));
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index a10d71a..b3234ff 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -22,6 +22,7 @@
#include "base/scoped_ptr.h"
#include "base/string16.h"
#include "chrome/browser/autofill/field_types.h"
+#include "chrome/browser/browser_thread.h"
#include "chrome/browser/cancelable_request.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/common/automation_constants.h"
@@ -76,9 +77,11 @@ namespace gfx {
class Point;
}
-class AutomationProvider : public base::RefCounted<AutomationProvider>,
- public IPC::Channel::Listener,
- public IPC::Message::Sender {
+class AutomationProvider
+ : public IPC::Channel::Listener,
+ public IPC::Message::Sender,
+ public base::RefCountedThreadSafe<AutomationProvider,
+ BrowserThread::DeleteOnUIThread> {
public:
explicit AutomationProvider(Profile* profile);
@@ -173,7 +176,8 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>,
DictionaryValue* GetDictionaryFromDownloadItem(const DownloadItem* download);
protected:
- friend class base::RefCounted<AutomationProvider>;
+ friend class BrowserThread;
+ friend class DeleteTask<AutomationProvider>;
virtual ~AutomationProvider();
// Helper function to find the browser window that contains a given
diff --git a/chrome/browser/automation/automation_provider_unittest.cc b/chrome/browser/automation/automation_provider_unittest.cc
index 356d0f4..c931701 100644
--- a/chrome/browser/automation/automation_provider_unittest.cc
+++ b/chrome/browser/automation/automation_provider_unittest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/browser_thread.h"
#include "chrome/browser/automation/chrome_frame_automation_provider.h"
#include "ipc/ipc_message.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -20,6 +21,9 @@ class MockChromeFrameAutomationProvider
};
TEST(AutomationProviderTest, TestInvalidChromeFrameMessage) {
+ MessageLoop message_loop;
+ BrowserThread ui_thread(BrowserThread::UI, &message_loop);
+
IPC::Message bad_msg(1, -1, IPC::Message::PRIORITY_NORMAL);
scoped_refptr<MockChromeFrameAutomationProvider>