Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/ipc/testshell/TestShellChild.cpp
Line
Count
Source (jump to first uncovered line)
1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
 * License, v. 2.0. If a copy of the MPL was not distributed with this
3
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5
#include "TestShellChild.h"
6
7
using mozilla::ipc::TestShellChild;
8
using mozilla::ipc::PTestShellCommandChild;
9
using mozilla::ipc::XPCShellEnvironment;
10
11
TestShellChild::TestShellChild()
12
: mXPCShell(XPCShellEnvironment::CreateEnvironment())
13
0
{
14
0
}
15
16
mozilla::ipc::IPCResult
17
TestShellChild::RecvExecuteCommand(const nsString& aCommand)
18
0
{
19
0
  if (mXPCShell->IsQuitting()) {
20
0
    NS_WARNING("Commands sent after quit command issued!");
21
0
    return IPC_FAIL_NO_REASON(this);
22
0
  }
23
0
24
0
  if (!mXPCShell->EvaluateString(aCommand)) {
25
0
    return IPC_FAIL_NO_REASON(this);
26
0
  }
27
0
  return IPC_OK();
28
0
}
29
30
PTestShellCommandChild*
31
TestShellChild::AllocPTestShellCommandChild(const nsString& aCommand)
32
0
{
33
0
  return new PTestShellCommandChild();
34
0
}
35
36
bool
37
TestShellChild::DeallocPTestShellCommandChild(PTestShellCommandChild* aCommand)
38
0
{
39
0
  delete aCommand;
40
0
  return true;
41
0
}
42
43
mozilla::ipc::IPCResult
44
TestShellChild::RecvPTestShellCommandConstructor(PTestShellCommandChild* aActor,
45
                                                 const nsString& aCommand)
46
0
{
47
0
  if (mXPCShell->IsQuitting()) {
48
0
    NS_WARNING("Commands sent after quit command issued!");
49
0
    return IPC_FAIL_NO_REASON(this);
50
0
  }
51
0
52
0
  nsString response;
53
0
  if (!mXPCShell->EvaluateString(aCommand, &response)) {
54
0
    return IPC_FAIL_NO_REASON(this);
55
0
  }
56
0
57
0
  if (!PTestShellCommandChild::Send__delete__(aActor, response)) {
58
0
    return IPC_FAIL_NO_REASON(this);
59
0
  }
60
0
  return IPC_OK();
61
0
}
62