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

Side by Side Diff: chrome/browser/chromeos/cros/network_library_unittest.cc

Issue 21046008: Convert all connect code to use NetworkHandler instead of NetworkLibrary (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Feedback Round 1 Created 7 years, 4 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 | Annotate | Revision Log
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 <pk11pub.h> 5 #include <pk11pub.h>
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/at_exit.h" 11 #include "base/at_exit.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/files/scoped_temp_dir.h" 13 #include "base/files/scoped_temp_dir.h"
14 #include "base/json/json_reader.h" 14 #include "base/json/json_reader.h"
15 #include "base/lazy_instance.h" 15 #include "base/lazy_instance.h"
16 #include "base/path_service.h" 16 #include "base/path_service.h"
17 #include "chrome/browser/chromeos/cros/network_library.h" 17 #include "chrome/browser/chromeos/cros/network_library.h"
18 #include "chrome/browser/chromeos/cros/network_library_impl_stub.h" 18 #include "chrome/browser/chromeos/cros/network_library_impl_stub.h"
19 #include "chrome/browser/chromeos/enrollment_dialog_view.h"
19 #include "chrome/browser/chromeos/login/mock_user_manager.h" 20 #include "chrome/browser/chromeos/login/mock_user_manager.h"
20 #include "chrome/browser/chromeos/login/user_manager.h" 21 #include "chrome/browser/chromeos/login/user_manager.h"
21 #include "chrome/browser/google_apis/test_util.h" 22 #include "chrome/browser/google_apis/test_util.h"
22 #include "chrome/common/chrome_paths.h" 23 #include "chrome/common/chrome_paths.h"
23 #include "chromeos/network/onc/onc_certificate_importer_impl.h" 24 #include "chromeos/network/onc/onc_certificate_importer_impl.h"
24 #include "chromeos/network/onc/onc_constants.h" 25 #include "chromeos/network/onc/onc_constants.h"
25 #include "chromeos/network/onc/onc_test_utils.h" 26 #include "chromeos/network/onc/onc_test_utils.h"
26 #include "chromeos/network/onc/onc_utils.h" 27 #include "chromeos/network/onc/onc_utils.h"
27 #include "crypto/nss_util.h" 28 #include "crypto/nss_util.h"
28 #include "net/base/crypto_module.h" 29 #include "net/base/crypto_module.h"
29 #include "testing/gmock/include/gmock/gmock.h" 30 #include "testing/gmock/include/gmock/gmock.h"
30 #include "testing/gtest/include/gtest/gtest.h" 31 #include "testing/gtest/include/gtest/gtest.h"
31 32
32 using ::testing::AnyNumber; 33 using ::testing::AnyNumber;
33 using ::testing::Return; 34 using ::testing::Return;
34 35
35 namespace chromeos { 36 namespace chromeos {
36 37
37 namespace { 38 namespace {
38 39
39 // Have to do a stub here because MOCK can't handle closure arguments. 40 // Have to do a stub here because MOCK can't handle closure arguments.
40 class StubEnrollmentDelegate : public EnrollmentDelegate { 41 class StubEnrollmentDelegate : public EnrollmentDelegate {
41 public: 42 public:
42 explicit StubEnrollmentDelegate() 43 explicit StubEnrollmentDelegate()
43 : did_enroll(false), 44 : did_enroll(false),
44 correct_args(false) {} 45 correct_args(false) {}
45 46
46 virtual void Enroll(const std::vector<std::string>& uri_list, 47 virtual bool Enroll(const std::vector<std::string>& uri_list,
47 const base::Closure& closure) OVERRIDE { 48 const base::Closure& closure) OVERRIDE {
48 std::vector<std::string> expected_uri_list; 49 std::vector<std::string> expected_uri_list;
49 expected_uri_list.push_back("http://youtu.be/dQw4w9WgXcQ"); 50 expected_uri_list.push_back("http://youtu.be/dQw4w9WgXcQ");
50 expected_uri_list.push_back("chrome-extension://abc/keygen-cert.html"); 51 expected_uri_list.push_back("chrome-extension://abc/keygen-cert.html");
51 if (uri_list == expected_uri_list) 52 if (uri_list == expected_uri_list)
52 correct_args = true; 53 correct_args = true;
53 54
54 did_enroll = true; 55 did_enroll = true;
55 closure.Run(); 56 closure.Run();
57 return true;
56 } 58 }
57 59
58 bool did_enroll; 60 bool did_enroll;
59 bool correct_args; 61 bool correct_args;
60 }; 62 };
61 63
62 void WifiNetworkConnectCallback(NetworkLibrary* cros, WifiNetwork* wifi) { 64 void WifiNetworkConnectCallback(NetworkLibrary* cros, WifiNetwork* wifi) {
63 cros->ConnectToWifiNetwork(wifi, false); 65 cros->ConnectToWifiNetwork(wifi, false);
64 } 66 }
65 67
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 445
444 // TODO(stevenjb): Test network profiles. 446 // TODO(stevenjb): Test network profiles.
445 447
446 // TODO(stevenjb): Test network devices. 448 // TODO(stevenjb): Test network devices.
447 449
448 // TODO(stevenjb): Test data plans. 450 // TODO(stevenjb): Test data plans.
449 451
450 // TODO(stevenjb): Test monitor network / device. 452 // TODO(stevenjb): Test monitor network / device.
451 453
452 } // namespace chromeos 454 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698