Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: content/browser/background_sync/background_sync_network_observer_unittest.cc

Issue 1874893002: Convert //content/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/background_sync/background_sync_network_observer.h" 5 #include "content/browser/background_sync/background_sync_network_observer.h"
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "content/public/test/test_browser_thread_bundle.h" 8 #include "content/public/test/test_browser_thread_bundle.h"
9 #include "net/base/network_change_notifier.h" 9 #include "net/base/network_change_notifier.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 12 matching lines...) Expand all
23 void SetNetwork(net::NetworkChangeNotifier::ConnectionType connection_type) { 23 void SetNetwork(net::NetworkChangeNotifier::ConnectionType connection_type) {
24 net::NetworkChangeNotifier::NotifyObserversOfNetworkChangeForTests( 24 net::NetworkChangeNotifier::NotifyObserversOfNetworkChangeForTests(
25 connection_type); 25 connection_type);
26 base::RunLoop().RunUntilIdle(); 26 base::RunLoop().RunUntilIdle();
27 } 27 }
28 28
29 void OnNetworkChanged() { network_changed_count_++; } 29 void OnNetworkChanged() { network_changed_count_++; }
30 30
31 TestBrowserThreadBundle browser_thread_bundle_; 31 TestBrowserThreadBundle browser_thread_bundle_;
32 32
33 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier; 33 std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier;
34 scoped_ptr<BackgroundSyncNetworkObserver> network_observer_; 34 std::unique_ptr<BackgroundSyncNetworkObserver> network_observer_;
35 int network_changed_count_; 35 int network_changed_count_;
36 }; 36 };
37 37
38 TEST_F(BackgroundSyncNetworkObserverTest, NetworkChangeInvokesCallback) { 38 TEST_F(BackgroundSyncNetworkObserverTest, NetworkChangeInvokesCallback) {
39 SetNetwork(net::NetworkChangeNotifier::CONNECTION_NONE); 39 SetNetwork(net::NetworkChangeNotifier::CONNECTION_NONE);
40 network_changed_count_ = 0; 40 network_changed_count_ = 0;
41 41
42 SetNetwork(net::NetworkChangeNotifier::CONNECTION_WIFI); 42 SetNetwork(net::NetworkChangeNotifier::CONNECTION_WIFI);
43 EXPECT_EQ(1, network_changed_count_); 43 EXPECT_EQ(1, network_changed_count_);
44 SetNetwork(net::NetworkChangeNotifier::CONNECTION_3G); 44 SetNetwork(net::NetworkChangeNotifier::CONNECTION_3G);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 EXPECT_TRUE(network_observer_->NetworkSufficient(NETWORK_STATE_ONLINE)); 99 EXPECT_TRUE(network_observer_->NetworkSufficient(NETWORK_STATE_ONLINE));
100 100
101 SetNetwork(net::NetworkChangeNotifier::CONNECTION_UNKNOWN); 101 SetNetwork(net::NetworkChangeNotifier::CONNECTION_UNKNOWN);
102 EXPECT_TRUE(network_observer_->NetworkSufficient(NETWORK_STATE_ONLINE)); 102 EXPECT_TRUE(network_observer_->NetworkSufficient(NETWORK_STATE_ONLINE));
103 103
104 SetNetwork(net::NetworkChangeNotifier::CONNECTION_NONE); 104 SetNetwork(net::NetworkChangeNotifier::CONNECTION_NONE);
105 EXPECT_FALSE(network_observer_->NetworkSufficient(NETWORK_STATE_ONLINE)); 105 EXPECT_FALSE(network_observer_->NetworkSufficient(NETWORK_STATE_ONLINE));
106 } 106 }
107 107
108 } // namespace content 108 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698