| OLD | NEW |
| 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 "extensions/common/features/simple_feature.h" | 5 #include "extensions/common/features/simple_feature.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 FeatureSessionType::UNKNOWN, | 444 FeatureSessionType::UNKNOWN, |
| 445 {FeatureSessionType::REGULAR}}, | 445 {FeatureSessionType::REGULAR}}, |
| 446 {"non kiosk feature in initial session", | 446 {"non kiosk feature in initial session", |
| 447 Feature::INVALID_SESSION_TYPE, | 447 Feature::INVALID_SESSION_TYPE, |
| 448 FeatureSessionType::INITIAL, | 448 FeatureSessionType::INITIAL, |
| 449 {FeatureSessionType::REGULAR}}, | 449 {FeatureSessionType::REGULAR}}, |
| 450 {"session agnostic feature in kiosk session", | 450 {"session agnostic feature in kiosk session", |
| 451 Feature::IS_AVAILABLE, | 451 Feature::IS_AVAILABLE, |
| 452 FeatureSessionType::KIOSK, | 452 FeatureSessionType::KIOSK, |
| 453 {}}, | 453 {}}, |
| 454 {"session agnostic feature in auto-launched kiosk session", |
| 455 Feature::IS_AVAILABLE, |
| 456 FeatureSessionType::AUTOLAUNCHED_KIOSK, |
| 457 {}}, |
| 454 {"session agnostic feature in regular session", | 458 {"session agnostic feature in regular session", |
| 455 Feature::IS_AVAILABLE, | 459 Feature::IS_AVAILABLE, |
| 456 FeatureSessionType::REGULAR, | 460 FeatureSessionType::REGULAR, |
| 457 {}}, | 461 {}}, |
| 458 {"session agnostic feature in unknown session", | 462 {"session agnostic feature in unknown session", |
| 459 Feature::IS_AVAILABLE, | 463 Feature::IS_AVAILABLE, |
| 460 FeatureSessionType::UNKNOWN, | 464 FeatureSessionType::UNKNOWN, |
| 461 {}}, | 465 {}}, |
| 462 {"feature with multiple session types", | 466 {"feature with multiple session types", |
| 463 Feature::IS_AVAILABLE, | 467 Feature::IS_AVAILABLE, |
| 464 FeatureSessionType::REGULAR, | 468 FeatureSessionType::REGULAR, |
| 465 {FeatureSessionType::REGULAR, FeatureSessionType::KIOSK}}, | 469 {FeatureSessionType::REGULAR, FeatureSessionType::KIOSK}}, |
| 466 {"feature with multiple session types in unknown session", | 470 {"feature with multiple session types in unknown session", |
| 467 Feature::INVALID_SESSION_TYPE, | 471 Feature::INVALID_SESSION_TYPE, |
| 468 FeatureSessionType::UNKNOWN, | 472 FeatureSessionType::UNKNOWN, |
| 469 {FeatureSessionType::REGULAR, FeatureSessionType::KIOSK}}, | 473 {FeatureSessionType::REGULAR, FeatureSessionType::KIOSK}}, |
| 470 {"feature with multiple session types in initial session", | 474 {"feature with multiple session types in initial session", |
| 471 Feature::INVALID_SESSION_TYPE, | 475 Feature::INVALID_SESSION_TYPE, |
| 472 FeatureSessionType::INITIAL, | 476 FeatureSessionType::INITIAL, |
| 473 {FeatureSessionType::REGULAR, FeatureSessionType::KIOSK}}}; | 477 {FeatureSessionType::REGULAR, FeatureSessionType::KIOSK}}, |
| 478 {"feature with auto-launched kiosk session type in regular session", |
| 479 Feature::INVALID_SESSION_TYPE, |
| 480 FeatureSessionType::AUTOLAUNCHED_KIOSK, |
| 481 {FeatureSessionType::REGULAR}}, |
| 482 {"feature with auto-launched kiosk session type in auto-launched kiosk", |
| 483 Feature::IS_AVAILABLE, |
| 484 FeatureSessionType::AUTOLAUNCHED_KIOSK, |
| 485 {FeatureSessionType::AUTOLAUNCHED_KIOSK}}, |
| 486 {"feature with kiosk session type in auto-launched kiosk session", |
| 487 Feature::IS_AVAILABLE, |
| 488 FeatureSessionType::AUTOLAUNCHED_KIOSK, |
| 489 {FeatureSessionType::KIOSK}}}; |
| 474 | 490 |
| 475 for (size_t i = 0; i < arraysize(kTestData); ++i) { | 491 for (size_t i = 0; i < arraysize(kTestData); ++i) { |
| 476 std::unique_ptr<base::AutoReset<FeatureSessionType>> current_session( | 492 std::unique_ptr<base::AutoReset<FeatureSessionType>> current_session( |
| 477 ScopedCurrentFeatureSessionType(kTestData[i].current_session_type)); | 493 ScopedCurrentFeatureSessionType(kTestData[i].current_session_type)); |
| 478 | 494 |
| 479 SimpleFeature feature; | 495 SimpleFeature feature; |
| 480 feature.set_session_types(kTestData[i].feature_session_types); | 496 feature.set_session_types(kTestData[i].feature_session_types); |
| 481 | 497 |
| 482 EXPECT_EQ(kTestData[i].expected_availability, | 498 EXPECT_EQ(kTestData[i].expected_availability, |
| 483 feature | 499 feature |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 EXPECT_NE(Feature::IS_AVAILABLE, | 854 EXPECT_NE(Feature::IS_AVAILABLE, |
| 839 feature | 855 feature |
| 840 ->IsAvailableToManifest("1", Manifest::TYPE_EXTENSION, | 856 ->IsAvailableToManifest("1", Manifest::TYPE_EXTENSION, |
| 841 Manifest::INVALID_LOCATION, | 857 Manifest::INVALID_LOCATION, |
| 842 Feature::UNSPECIFIED_PLATFORM) | 858 Feature::UNSPECIFIED_PLATFORM) |
| 843 .result()); | 859 .result()); |
| 844 } | 860 } |
| 845 } | 861 } |
| 846 | 862 |
| 847 } // namespace extensions | 863 } // namespace extensions |
| OLD | NEW |