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

Side by Side Diff: chrome/browser/chromeos/net/network_state_notifier_unittest.cc

Issue 2528013002: Initialize the message center as part of the testing browser process (Closed)
Patch Set: re-uploding due to time outs Created 4 years 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/net/network_state_notifier.h" 5 #include "chrome/browser/chromeos/net/network_state_notifier.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 public: 59 public:
60 NetworkStateNotifierTest() {} 60 NetworkStateNotifierTest() {}
61 ~NetworkStateNotifierTest() override {} 61 ~NetworkStateNotifierTest() override {}
62 62
63 void SetUp() override { 63 void SetUp() override {
64 testing::Test::SetUp(); 64 testing::Test::SetUp();
65 DBusThreadManager::Initialize(); 65 DBusThreadManager::Initialize();
66 LoginState::Initialize(); 66 LoginState::Initialize();
67 SetupDefaultShillState(); 67 SetupDefaultShillState();
68 NetworkHandler::Initialize(); 68 NetworkHandler::Initialize();
69 message_center::MessageCenter::Initialize();
70 base::RunLoop().RunUntilIdle(); 69 base::RunLoop().RunUntilIdle();
71 network_connect_delegate_.reset(new NetworkConnectTestDelegate); 70 network_connect_delegate_.reset(new NetworkConnectTestDelegate);
72 NetworkConnect::Initialize(network_connect_delegate_.get()); 71 NetworkConnect::Initialize(network_connect_delegate_.get());
73 } 72 }
74 73
75 void TearDown() override { 74 void TearDown() override {
76 NetworkConnect::Shutdown(); 75 NetworkConnect::Shutdown();
77 network_connect_delegate_.reset(); 76 network_connect_delegate_.reset();
78 message_center::MessageCenter::Shutdown();
79 LoginState::Shutdown(); 77 LoginState::Shutdown();
80 NetworkHandler::Shutdown(); 78 NetworkHandler::Shutdown();
81 DBusThreadManager::Shutdown(); 79 DBusThreadManager::Shutdown();
82 testing::Test::TearDown(); 80 testing::Test::TearDown();
83 } 81 }
84 82
85 protected: 83 protected:
86 void SetupDefaultShillState() { 84 void SetupDefaultShillState() {
87 base::RunLoop().RunUntilIdle(); 85 base::RunLoop().RunUntilIdle();
88 ShillDeviceClient::TestInterface* device_test = 86 ShillDeviceClient::TestInterface* device_test =
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 base::RunLoop().RunUntilIdle(); 123 base::RunLoop().RunUntilIdle();
126 // Failure should spawn a notification. 124 // Failure should spawn a notification.
127 message_center::MessageCenter* message_center = 125 message_center::MessageCenter* message_center =
128 message_center::MessageCenter::Get(); 126 message_center::MessageCenter::Get();
129 EXPECT_TRUE(message_center->FindVisibleNotificationById( 127 EXPECT_TRUE(message_center->FindVisibleNotificationById(
130 NetworkStateNotifier::kNetworkConnectNotificationId)); 128 NetworkStateNotifier::kNetworkConnectNotificationId));
131 } 129 }
132 130
133 } // namespace test 131 } // namespace test
134 } // namespace chromeos 132 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698