OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/chromeos/status/data_promo_notification.h" | 5 #include "chrome/browser/chromeos/status/data_promo_notification.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" | 10 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 void SetUp() override { | 64 void SetUp() override { |
65 testing::Test::SetUp(); | 65 testing::Test::SetUp(); |
66 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 66 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
67 switches::kEnableDataSaverPrompt); | 67 switches::kEnableDataSaverPrompt); |
68 DBusThreadManager::Initialize(); | 68 DBusThreadManager::Initialize(); |
69 NetworkHandler::Initialize(); | 69 NetworkHandler::Initialize(); |
70 data_promo_notification_.reset(new DataPromoNotification); | 70 data_promo_notification_.reset(new DataPromoNotification); |
71 SetupUser(); | 71 SetupUser(); |
72 SetupNetworkShillState(); | 72 SetupNetworkShillState(); |
73 message_center::MessageCenter::Initialize(); | |
74 base::RunLoop().RunUntilIdle(); | 73 base::RunLoop().RunUntilIdle(); |
75 network_connect_delegate_.reset(new NetworkConnectTestDelegate); | 74 network_connect_delegate_.reset(new NetworkConnectTestDelegate); |
76 chromeos::NetworkConnect::Initialize(network_connect_delegate_.get()); | 75 chromeos::NetworkConnect::Initialize(network_connect_delegate_.get()); |
77 } | 76 } |
78 | 77 |
79 void TearDown() override { | 78 void TearDown() override { |
80 chromeos::NetworkConnect::Shutdown(); | 79 chromeos::NetworkConnect::Shutdown(); |
81 network_connect_delegate_.reset(); | 80 network_connect_delegate_.reset(); |
82 message_center::MessageCenter::Shutdown(); | |
83 LoginState::Shutdown(); | 81 LoginState::Shutdown(); |
84 profile_manager_.reset(); | 82 profile_manager_.reset(); |
85 user_manager_enabler_.reset(); | 83 user_manager_enabler_.reset(); |
86 data_promo_notification_.reset(); | 84 data_promo_notification_.reset(); |
87 NetworkHandler::Shutdown(); | 85 NetworkHandler::Shutdown(); |
88 DBusThreadManager::Shutdown(); | 86 DBusThreadManager::Shutdown(); |
89 testing::Test::TearDown(); | 87 testing::Test::TearDown(); |
90 } | 88 } |
91 | 89 |
92 protected: | 90 protected: |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 157 |
160 chromeos::NetworkConnect::Get()->ConnectToNetworkId(kCellularGuid); | 158 chromeos::NetworkConnect::Get()->ConnectToNetworkId(kCellularGuid); |
161 base::RunLoop().RunUntilIdle(); | 159 base::RunLoop().RunUntilIdle(); |
162 // Connecting to cellular network (which here makes it the default network) | 160 // Connecting to cellular network (which here makes it the default network) |
163 // should trigger the Data Saver notification. | 161 // should trigger the Data Saver notification. |
164 EXPECT_TRUE(message_center->FindVisibleNotificationById(kNotificationId)); | 162 EXPECT_TRUE(message_center->FindVisibleNotificationById(kNotificationId)); |
165 } | 163 } |
166 | 164 |
167 } // namespace test | 165 } // namespace test |
168 } // namespace chromeos | 166 } // namespace chromeos |
OLD | NEW |