/src/mozilla-central/toolkit/components/telemetry/tests/gtest/TelemetryFixture.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* Any copyright is dedicated to the Public Domain. |
2 | | * http://creativecommons.org/publicdomain/zero/1.0/ |
3 | | */ |
4 | | |
5 | | #include "TelemetryFixture.h" |
6 | | #include "mozilla/dom/SimpleGlobalObject.h" |
7 | | |
8 | | using namespace mozilla; |
9 | | |
10 | | void |
11 | | TelemetryTestFixture::SetUp() |
12 | 0 | { |
13 | 0 | mTelemetry = do_GetService("@mozilla.org/base/telemetry;1"); |
14 | 0 |
|
15 | 0 | mCleanGlobal = |
16 | 0 | dom::SimpleGlobalObject::Create(dom::SimpleGlobalObject::GlobalType::BindingDetail); |
17 | 0 |
|
18 | 0 | // The test must fail if we failed getting the global. |
19 | 0 | ASSERT_NE(mCleanGlobal, nullptr) << "SimpleGlobalObject must return a valid global object."; |
20 | 0 | } |
21 | | |
22 | | AutoJSContextWithGlobal::AutoJSContextWithGlobal(JSObject* aGlobalObject) |
23 | | : mCx(nullptr) |
24 | 0 | { |
25 | 0 | // The JS API must initialize correctly. |
26 | 0 | MOZ_ALWAYS_TRUE(mJsAPI.Init(aGlobalObject)); |
27 | 0 | } |
28 | | |
29 | | JSContext* AutoJSContextWithGlobal::GetJSContext() const |
30 | 0 | { |
31 | 0 | return mJsAPI.cx(); |
32 | 0 | } |