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

Side by Side Diff: content/shell/renderer/test_runner/WebTask.cpp

Issue 110533009: Import TestRunner library into chromium. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 7 years 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
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/shell/renderer/test_runner/WebTask.h"
6
7 #include <algorithm>
8 #include "third_party/WebKit/public/web/WebKit.h"
9
10 using namespace std;
11
12 namespace WebTestRunner {
13
14 WebTask::WebTask(WebTaskList* list)
15 : m_taskList(list)
16 {
17 m_taskList->registerTask(this);
18 }
19
20 WebTask::~WebTask()
21 {
22 if (m_taskList)
23 m_taskList->unregisterTask(this);
24 }
25
26 WebTaskList::WebTaskList()
27 {
28 }
29
30 WebTaskList::~WebTaskList()
31 {
32 revokeAll();
33 }
34
35 void WebTaskList::registerTask(WebTask* task)
36 {
37 m_tasks.push_back(task);
38 }
39
40 void WebTaskList::unregisterTask(WebTask* task)
41 {
42 vector<WebTask*>::iterator iter = find(m_tasks.begin(), m_tasks.end(), task) ;
43 if (iter != m_tasks.end())
44 m_tasks.erase(iter);
45 }
46
47 void WebTaskList::revokeAll()
48 {
49 while (!m_tasks.empty())
50 m_tasks[0]->cancel();
51 }
52
53 }
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/WebTask.h ('k') | content/shell/renderer/test_runner/WebTestDelegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698