| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/callback.h" | 6 #include "base/callback.h" |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/task_scheduler/post_task.h" | 9 #include "base/task_scheduler/post_task.h" |
| 10 #include "chrome/browser/extensions/api/networking_private/networking_private_cr
edentials_getter.h" | 10 #include "chrome/browser/extensions/api/networking_private/networking_private_cr
edentials_getter.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 void RunTest(bool use_test_network) { | 23 void RunTest(bool use_test_network) { |
| 24 base::RunLoop run_loop; | 24 base::RunLoop run_loop; |
| 25 quit_closure_ = run_loop.QuitClosure(); | 25 quit_closure_ = run_loop.QuitClosure(); |
| 26 | 26 |
| 27 if (use_test_network) | 27 if (use_test_network) |
| 28 network_ = extensions::mojom::WiFiCredentialsGetter::kWiFiTestNetwork; | 28 network_ = extensions::mojom::WiFiCredentialsGetter::kWiFiTestNetwork; |
| 29 | 29 |
| 30 done_called_ = false; | 30 done_called_ = false; |
| 31 base::PostTaskWithTraits( | 31 base::PostTaskWithTraits( |
| 32 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 32 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
| 33 base::TaskPriority::BACKGROUND), | |
| 34 base::Bind(&NetworkingPrivateCredentialsGetterTest::GetCredentials, | 33 base::Bind(&NetworkingPrivateCredentialsGetterTest::GetCredentials, |
| 35 base::Unretained(this))); | 34 base::Unretained(this))); |
| 36 run_loop.Run(); | 35 run_loop.Run(); |
| 37 | 36 |
| 38 EXPECT_TRUE(done_called_); | 37 EXPECT_TRUE(done_called_); |
| 39 } | 38 } |
| 40 | 39 |
| 41 private: | 40 private: |
| 42 void GetCredentials() { | 41 void GetCredentials() { |
| 43 std::unique_ptr<extensions::NetworkingPrivateCredentialsGetter> getter( | 42 std::unique_ptr<extensions::NetworkingPrivateCredentialsGetter> getter( |
| (...skipping 28 matching lines...) Expand all Loading... |
| 72 | 71 |
| 73 IN_PROC_BROWSER_TEST_F(NetworkingPrivateCredentialsGetterTest, | 72 IN_PROC_BROWSER_TEST_F(NetworkingPrivateCredentialsGetterTest, |
| 74 GetCredentialsSuccess) { | 73 GetCredentialsSuccess) { |
| 75 RunTest(true); | 74 RunTest(true); |
| 76 } | 75 } |
| 77 | 76 |
| 78 IN_PROC_BROWSER_TEST_F(NetworkingPrivateCredentialsGetterTest, | 77 IN_PROC_BROWSER_TEST_F(NetworkingPrivateCredentialsGetterTest, |
| 79 GetCredentialsFailure) { | 78 GetCredentialsFailure) { |
| 80 RunTest(false); | 79 RunTest(false); |
| 81 } | 80 } |
| OLD | NEW |