LCOV - code coverage report
Current view: top level - dom/bindings/test - TestInterfaceIterableDouble.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 35 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 14 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 file,
       3             :  * You can obtain one at http://mozilla.org/MPL/2.0/. */
       4             : 
       5             : #include "mozilla/dom/TestInterfaceIterableDouble.h"
       6             : #include "mozilla/dom/TestInterfaceJSMaplikeSetlikeIterableBinding.h"
       7             : #include "nsPIDOMWindow.h"
       8             : #include "mozilla/dom/BindingUtils.h"
       9             : 
      10             : namespace mozilla {
      11             : namespace dom {
      12             : 
      13           0 : NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(TestInterfaceIterableDouble, mParent)
      14             : 
      15           0 : NS_IMPL_CYCLE_COLLECTING_ADDREF(TestInterfaceIterableDouble)
      16           0 : NS_IMPL_CYCLE_COLLECTING_RELEASE(TestInterfaceIterableDouble)
      17             : 
      18           0 : NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TestInterfaceIterableDouble)
      19           0 : NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
      20           0 : NS_INTERFACE_MAP_ENTRY(nsISupports)
      21           0 : NS_INTERFACE_MAP_END
      22             : 
      23           0 : TestInterfaceIterableDouble::TestInterfaceIterableDouble(nsPIDOMWindowInner* aParent)
      24           0 :   : mParent(aParent)
      25             : {
      26           0 :   mValues.AppendElement(std::pair<nsString, nsString>(NS_LITERAL_STRING("a"),
      27           0 :                                                       NS_LITERAL_STRING("b")));
      28           0 :   mValues.AppendElement(std::pair<nsString, nsString>(NS_LITERAL_STRING("c"),
      29           0 :                                                       NS_LITERAL_STRING("d")));
      30           0 :   mValues.AppendElement(std::pair<nsString, nsString>(NS_LITERAL_STRING("e"),
      31           0 :                                                       NS_LITERAL_STRING("f")));
      32           0 : }
      33             : 
      34             : //static
      35             : already_AddRefed<TestInterfaceIterableDouble>
      36           0 : TestInterfaceIterableDouble::Constructor(const GlobalObject& aGlobal,
      37             :                                          ErrorResult& aRv)
      38             : {
      39           0 :   nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports());
      40           0 :   if (!window) {
      41           0 :     aRv.Throw(NS_ERROR_FAILURE);
      42           0 :     return nullptr;
      43             :   }
      44             : 
      45           0 :   RefPtr<TestInterfaceIterableDouble> r = new TestInterfaceIterableDouble(window);
      46           0 :   return r.forget();
      47             : }
      48             : 
      49             : JSObject*
      50           0 : TestInterfaceIterableDouble::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
      51             : {
      52           0 :   return TestInterfaceIterableDoubleBinding::Wrap(aCx, this, aGivenProto);
      53             : }
      54             : 
      55             : nsPIDOMWindowInner*
      56           0 : TestInterfaceIterableDouble::GetParentObject() const
      57             : {
      58           0 :   return mParent;
      59             : }
      60             : 
      61             : size_t
      62           0 : TestInterfaceIterableDouble::GetIterableLength()
      63             : {
      64           0 :   return mValues.Length();
      65             : }
      66             : 
      67             : nsAString&
      68           0 : TestInterfaceIterableDouble::GetKeyAtIndex(uint32_t aIndex)
      69             : {
      70           0 :   MOZ_ASSERT(aIndex < mValues.Length());
      71           0 :   return mValues.ElementAt(aIndex).first;
      72             : }
      73             : 
      74             : nsAString&
      75           0 : TestInterfaceIterableDouble::GetValueAtIndex(uint32_t aIndex)
      76             : {
      77           0 :   MOZ_ASSERT(aIndex < mValues.Length());
      78           0 :   return mValues.ElementAt(aIndex).second;
      79             : }
      80             : 
      81             : } // namespace dom
      82             : } // namespace mozilla

Generated by: LCOV version 1.13