Exemplo n.º 1
0
TEST_F(NetworkStateNotifierTest, AddObserver)
{
    StateObserver observer;
    m_notifier.addObserver(&observer, executionContext());
    EXPECT_TRUE(verifyObservations(observer, WebConnectionTypeNone, kNoneMaxBandwidthMbps));

    setConnection(WebConnectionTypeBluetooth, kBluetoothMaxBandwidthMbps);
    EXPECT_TRUE(verifyObservations(observer, WebConnectionTypeBluetooth, kBluetoothMaxBandwidthMbps));
    EXPECT_EQ(observer.callbackCount(), 1);
}
TEST_F(NetworkStateNotifierTest, AddObserver)
{
    StateObserver observer;
    m_notifier.addObserver(&observer, executionContext());
    EXPECT_EQ(observer.observedType(), ConnectionTypeNone);

    setType(ConnectionTypeBluetooth);
    EXPECT_EQ(observer.observedType(), ConnectionTypeBluetooth);
    EXPECT_EQ(observer.callbackCount(), 1);
}
Exemplo n.º 3
0
 bool verifyObservations(const StateObserver& observer, WebConnectionType type, double maxBandwidthMbps)
 {
     EXPECT_EQ(observer.observedType(), type);
     EXPECT_EQ(observer.observedMaxBandwidth(), maxBandwidthMbps);
     return observer.observedType() == type && observer.observedMaxBandwidth() == maxBandwidthMbps;
 }