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

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

Issue 2620463003: Add getGlobalPolicy to networkingPrivate API. (Closed)
Patch Set: Add dcheck 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 return base::MakeUnique<base::DictionaryValue>();
188 }
189
186 bool EnableNetworkType(const std::string& type) override { 190 bool EnableNetworkType(const std::string& type) override {
187 enabled_[type] = true; 191 enabled_[type] = true;
188 return !fail_; 192 return !fail_;
189 } 193 }
190 194
191 bool DisableNetworkType(const std::string& type) override { 195 bool DisableNetworkType(const std::string& type) override {
192 disabled_[type] = true; 196 disabled_[type] = true;
193 return !fail_; 197 return !fail_;
194 } 198 }
195 199
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 } 459 }
456 460
457 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTest, UnlockCellularSim) { 461 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTest, UnlockCellularSim) {
458 EXPECT_TRUE(RunNetworkingSubtest("unlockCellularSim")) << message_; 462 EXPECT_TRUE(RunNetworkingSubtest("unlockCellularSim")) << message_;
459 } 463 }
460 464
461 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTest, SetCellularSimState) { 465 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTest, SetCellularSimState) {
462 EXPECT_TRUE(RunNetworkingSubtest("setCellularSimState")) << message_; 466 EXPECT_TRUE(RunNetworkingSubtest("setCellularSimState")) << message_;
463 } 467 }
464 468
469 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTest, GetGlobalPolicy) {
470 EXPECT_TRUE(RunNetworkingSubtest("getGlobalPolicy")) << message_;
471 }
472
465 // Test failure case 473 // Test failure case
466 474
467 class NetworkingPrivateApiTestFail : public NetworkingPrivateApiTest { 475 class NetworkingPrivateApiTestFail : public NetworkingPrivateApiTest {
468 public: 476 public:
469 NetworkingPrivateApiTestFail() { s_test_delegate_->set_fail(true); } 477 NetworkingPrivateApiTestFail() { s_test_delegate_->set_fail(true); }
470 478
471 protected: 479 protected:
472 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateApiTestFail); 480 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateApiTestFail);
473 }; 481 };
474 482
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 } 517 }
510 518
511 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTestFail, GetDeviceStates) { 519 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTestFail, GetDeviceStates) {
512 EXPECT_FALSE(RunNetworkingSubtest("getDeviceStates")) << message_; 520 EXPECT_FALSE(RunNetworkingSubtest("getDeviceStates")) << message_;
513 } 521 }
514 522
515 // Note: Synchronous methods never fail: 523 // Note: Synchronous methods never fail:
516 // * disableNetworkType 524 // * disableNetworkType
517 // * enableNetworkType 525 // * enableNetworkType
518 // * requestNetworkScan 526 // * requestNetworkScan
527 // * getGlobalPolicy
519 528
520 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTestFail, StartConnect) { 529 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTestFail, StartConnect) {
521 EXPECT_FALSE(RunNetworkingSubtest("startConnect")) << message_; 530 EXPECT_FALSE(RunNetworkingSubtest("startConnect")) << message_;
522 } 531 }
523 532
524 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTestFail, StartDisconnect) { 533 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTestFail, StartDisconnect) {
525 EXPECT_FALSE(RunNetworkingSubtest("startDisconnect")) << message_; 534 EXPECT_FALSE(RunNetworkingSubtest("startDisconnect")) << message_;
526 } 535 }
527 536
528 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTestFail, StartActivate) { 537 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTestFail, StartActivate) {
(...skipping 29 matching lines...) Expand all
558 EXPECT_FALSE(RunNetworkingSubtest("unlockCellularSim")) << message_; 567 EXPECT_FALSE(RunNetworkingSubtest("unlockCellularSim")) << message_;
559 } 568 }
560 569
561 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTestFail, SetCellularSimState) { 570 IN_PROC_BROWSER_TEST_F(NetworkingPrivateApiTestFail, SetCellularSimState) {
562 EXPECT_FALSE(RunNetworkingSubtest("setCellularSimState")) << message_; 571 EXPECT_FALSE(RunNetworkingSubtest("setCellularSimState")) << message_;
563 } 572 }
564 573
565 #endif // defined(OS_WIN) 574 #endif // defined(OS_WIN)
566 575
567 } // namespace extensions 576 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698