/*
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 *
*/

describe('Network (navigator.network)', function () {
	it("should exist", function() {
        expect(navigator.network).toBeDefined();
	});

    describe('Network Information API', function () {
        it("connection should exist", function() {
            expect(navigator.network.connection).toBeDefined();
        });

        it("should contain connection properties", function() {
            expect(navigator.network.connection.type).toBeDefined();
        });

        it("should define constants for connection status", function() {
            expect(Connection.UNKNOWN).toBe("unknown");
            expect(Connection.ETHERNET).toBe("ethernet");
            expect(Connection.WIFI).toBe("wifi");
            expect(Connection.CELL_2G).toBe("2g");
            expect(Connection.CELL_3G).toBe("3g");
            expect(Connection.CELL_4G).toBe("4g");
            expect(Connection.NONE).toBe("none");
        });
    });
});

@@ -836,23 +836,26 @@
 vigator.
-network
+connection
 )', func
@@ -864,17 +864,20 @@
 on () %7B%0A
-%09
+    
 it(%22shou
@@ -936,155 +936,399 @@
 work
-).toBeDefined();%0A%09%7D);%0A%0A    describe('Network Information API', function () %7B%0A        it(%22connection should exist%22, function() %7B%0A            expect(
+ && navigator.network.connection).toBeDefined();%0A        expect(navigator.connection).toBeDefined();%0A    %7D);%0A%0A    it(%22should be set to a valid value%22, function() %7B%0A        var validValues = %7B%0A            'unknown': 1,%0A            'ethernet': 1,%0A            'wifi': 1,%0A            '2g': 1,%0A            '3g': 1,%0A            '4g': 1,%0A            'none': 1%0A        %7D;%0A        expect(validValues%5B
 navi
@@ -1329,32 +1329,24 @@
 s%5Bnavigator.
-network.
 connection).
@@ -1347,42 +1347,34 @@
 tion
-).toBeDefined(
+.type%5D).toBe(1
 );%0A    
- 
-   
 %7D);%0A%0A
-    
     
@@ -1388,36 +1388,64 @@
 uld 
-contain connection propertie
+have the same value in deprecated and non-deprecated api
 s%22, 
@@ -1449,36 +1449,32 @@
 %22, function() %7B%0A
-    
         expect(n
@@ -1507,39 +1507,53 @@
 n.type).toBe
-Defined(
+(navigator.connection.type
 );%0A
-    
     %7D);%0A%0A   
@@ -1549,20 +1549,16 @@
    %7D);%0A%0A
-    
     it(%22
@@ -1618,36 +1618,32 @@
 ion() %7B%0A        
-    
 expect(Connectio
@@ -1666,28 +1666,24 @@
 %22unknown%22);%0A
-    
         expe
@@ -1724,36 +1724,32 @@
 rnet%22);%0A        
-    
 expect(Connectio
@@ -1766,28 +1766,24 @@
 Be(%22wifi%22);%0A
-    
         expe
@@ -1817,36 +1817,32 @@
 (%222g%22);%0A        
-    
 expect(Connectio
@@ -1860,28 +1860,24 @@
 toBe(%223g%22);%0A
-    
         expe
@@ -1915,28 +1915,24 @@
 %22);%0A        
-    
 expect(Conne
@@ -1961,20 +1961,8 @@
 %22);%0A
-        %7D);%0A
     

Test both navigator.network.connection and navigator.connection