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

Side by Side Diff: chrome/browser/extensions/api/networking_private/networking_private_apitest.cc

Issue 2620463003: Add getGlobalPolicy to networkingPrivate API. (Closed)
Patch Set: Created 3 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <map> 7 #include <map>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 return result; 176 return result;
177 result.reset(new DeviceStateList); 177 result.reset(new DeviceStateList);
178 std::unique_ptr<api::networking_private::DeviceStateProperties> properties( 178 std::unique_ptr<api::networking_private::DeviceStateProperties> properties(
179 new api::networking_private::DeviceStateProperties); 179 new api::networking_private::DeviceStateProperties);
180 properties->type = api::networking_private::NETWORK_TYPE_ETHERNET; 180 properties->type = api::networking_private::NETWORK_TYPE_ETHERNET;
181 properties->state = api::networking_private::DEVICE_STATE_TYPE_ENABLED; 181 properties->state = api::networking_private::DEVICE_STATE_TYPE_ENABLED;
182 result->push_back(std::move(properties)); 182 result->push_back(std::move(properties));
183 return result; 183 return result;
184 } 184 }
185 185
186 std::unique_ptr<base::DictionaryValue> GetGlobalPolicy() override {
187 auto result = base::MakeUnique<base::DictionaryValue>();
188 result->SetBooleanWithoutPathExpansion(
tbarzic 2017/01/06 22:43:17 I'd add an extra property to the policy dict - to
stevenjb 2017/01/09 19:30:37 Good call, but I will actually do that in the chro
189 onc::global_network_config::kAllowOnlyPolicyNetworksToAutoconnect,
190 true);
191 result->SetBooleanWithoutPathExpansion(
192 onc::global_network_config::kAllowOnlyPolicyNetworksToConnect, false);
193 return result;
194 }
195
186 bool EnableNetworkType(const std::string& type) override { 196 bool EnableNetworkType(const std::string& type) override {
187 enabled_[type] = true; 197 enabled_[type] = true;
188 return !fail_; 198 return !fail_;
189 } 199 }
190 200
191 bool DisableNetworkType(const std::string& type) override { 201 bool DisableNetworkType(const std::string& type) override {
192 disabled_[type] = true; 202 disabled_[type] = true;
193 return !fail_; 203 return !fail_;
194 } 204 }
195 205
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 } 465 }
456 466
457 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTest, UnlockCellularSim) { 467 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTest, UnlockCellularSim) {
458 EXPECT_TRUE(RunNetworkingSubtest("unlockCellularSim")) << message_; 468 EXPECT_TRUE(RunNetworkingSubtest("unlockCellularSim")) << message_;
459 } 469 }
460 470
461 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTest, SetCellularSimState) { 471 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTest, SetCellularSimState) {
462 EXPECT_TRUE(RunNetworkingSubtest("setCellularSimState")) << message_; 472 EXPECT_TRUE(RunNetworkingSubtest("setCellularSimState")) << message_;
463 } 473 }
464 474
475 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTest, GetGlobalPolicy) {
476 EXPECT_TRUE(RunNetworkingSubtest("getGlobalPolicy")) << message_;
477 }
478
465 // Test failure case 479 // Test failure case
466 480
467 class NetworkingPrivateApiTestFail : public NetworkingPrivateApiTest { 481 class NetworkingPrivateApiTestFail : public NetworkingPrivateApiTest {
468 public: 482 public:
469 NetworkingPrivateApiTestFail() { s_test_delegate_->set_fail(true); } 483 NetworkingPrivateApiTestFail() { s_test_delegate_->set_fail(true); }
470 484
471 protected: 485 protected:
472 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateApiTestFail); 486 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateApiTestFail);
473 }; 487 };
474 488
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 } 523 }
510 524
511 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTestFail, GetDeviceStates) { 525 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTestFail, GetDeviceStates) {
512 EXPECT_FALSE(RunNetworkingSubtest("getDeviceStates")) << message_; 526 EXPECT_FALSE(RunNetworkingSubtest("getDeviceStates")) << message_;
513 } 527 }
514 528
515 // Note: Synchronous methods never fail: 529 // Note: Synchronous methods never fail:
516 // * disableNetworkType 530 // * disableNetworkType
517 // * enableNetworkType 531 // * enableNetworkType
518 // * requestNetworkScan 532 // * requestNetworkScan
533 // * getGlobalPolicy
519 534
520 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTestFail, StartConnect) { 535 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTestFail, StartConnect) {
521 EXPECT_FALSE(RunNetworkingSubtest("startConnect")) << message_; 536 EXPECT_FALSE(RunNetworkingSubtest("startConnect")) << message_;
522 } 537 }
523 538
524 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTestFail, StartDisconnect) { 539 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTestFail, StartDisconnect) {
525 EXPECT_FALSE(RunNetworkingSubtest("startDisconnect")) << message_; 540 EXPECT_FALSE(RunNetworkingSubtest("startDisconnect")) << message_;
526 } 541 }
527 542
528 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTestFail, StartActivate) { 543 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTestFail, StartActivate) {
(...skipping 29 matching lines...) Expand all
558 EXPECT_FALSE(RunNetworkingSubtest("unlockCellularSim")) << message_; 573 EXPECT_FALSE(RunNetworkingSubtest("unlockCellularSim")) << message_;
559 } 574 }
560 575
561 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTestFail, SetCellularSimState) { 576 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTestFail, SetCellularSimState) {
562 EXPECT_FALSE(RunNetworkingSubtest("setCellularSimState")) << message_; 577 EXPECT_FALSE(RunNetworkingSubtest("setCellularSimState")) << message_;
563 } 578 }
564 579
565 #endif // defined(OS_WIN) 580 #endif // defined(OS_WIN)
566 581
567 } // namespace extensions 582 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698