diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-08 00:56:36 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-08 00:56:36 +0000 |
commit | 23cf9bd77696ac52ef7b3c9f61d6ad6e8528f5ea (patch) | |
tree | f1817b0024dc0b9e0f6619202c32378507286807 /ppapi/tests | |
parent | 576f4ff53b4e0d9ec1c9d127df306d8c8c403c13 (diff) | |
download | chromium_src-23cf9bd77696ac52ef7b3c9f61d6ad6e8528f5ea.zip chromium_src-23cf9bd77696ac52ef7b3c9f61d6ad6e8528f5ea.tar.gz chromium_src-23cf9bd77696ac52ef7b3c9f61d6ad6e8528f5ea.tar.bz2 |
"Replace" PPB_Flash's GetSettingInt with a more general GetSetting.
BUG=none
TEST=ui_tests PPAPITest.Flash and OutOfProcessPPAPITest.Flash
Review URL: https://chromiumcodereview.appspot.com/10546060
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141138 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/tests')
-rw-r--r-- | ppapi/tests/test_flash.cc | 63 | ||||
-rw-r--r-- | ppapi/tests/test_flash.h | 2 |
2 files changed, 65 insertions, 0 deletions
diff --git a/ppapi/tests/test_flash.cc b/ppapi/tests/test_flash.cc index 51ee08c..3deba37 100644 --- a/ppapi/tests/test_flash.cc +++ b/ppapi/tests/test_flash.cc @@ -33,6 +33,8 @@ void TestFlash::RunTests(const std::string& filter) { RUN_TEST(GetLocalTimeZoneOffset, filter); RUN_TEST(GetCommandLineArgs, filter); RUN_TEST(GetDeviceID, filter); + RUN_TEST(GetSettingInt, filter); + RUN_TEST(GetSetting, filter); } std::string TestFlash::TestSetInstanceAlwaysOnTop() { @@ -108,6 +110,67 @@ std::string TestFlash::TestGetDeviceID() { PASS(); } +std::string TestFlash::TestGetSettingInt() { + // This only works out of process. + if (testing_interface_->IsOutOfProcess()) { + int32_t is_3denabled = flash_interface_->GetSettingInt( + instance_->pp_instance(), PP_FLASHSETTING_3DENABLED); + ASSERT_TRUE(is_3denabled == 0 || is_3denabled == 1); + + int32_t is_incognito = flash_interface_->GetSettingInt( + instance_->pp_instance(), PP_FLASHSETTING_INCOGNITO); + ASSERT_TRUE(is_incognito == 0 || is_incognito == 1); + + int32_t is_stage3denabled = flash_interface_->GetSettingInt( + instance_->pp_instance(), PP_FLASHSETTING_STAGE3DENABLED); + // This may "fail" if 3d isn't enabled. + ASSERT_TRUE((is_stage3denabled == 0 || is_stage3denabled == 1) || + (is_stage3denabled == -1 && is_3denabled == 0)); + } + + // Invalid instance cases. + int32_t result = flash_interface_->GetSettingInt( + 0, PP_FLASHSETTING_3DENABLED); + ASSERT_EQ(-1, result); + result = flash_interface_->GetSettingInt(0, PP_FLASHSETTING_INCOGNITO); + ASSERT_EQ(-1, result); + result = flash_interface_->GetSettingInt(0, PP_FLASHSETTING_STAGE3DENABLED); + ASSERT_EQ(-1, result); + + PASS(); +} + +std::string TestFlash::TestGetSetting() { + // This only works out of process. + if (testing_interface_->IsOutOfProcess()) { + Var is_3denabled(pp::PASS_REF, flash_interface_->GetSetting( + instance_->pp_instance(), PP_FLASHSETTING_3DENABLED)); + ASSERT_TRUE(is_3denabled.is_bool()); + + Var is_incognito(pp::PASS_REF, flash_interface_->GetSetting( + instance_->pp_instance(), PP_FLASHSETTING_INCOGNITO)); + ASSERT_TRUE(is_incognito.is_bool()); + + Var is_stage3denabled(pp::PASS_REF, flash_interface_->GetSetting( + instance_->pp_instance(), PP_FLASHSETTING_STAGE3DENABLED)); + // This may "fail" if 3d isn't enabled. + ASSERT_TRUE(is_stage3denabled.is_bool() || + (is_stage3denabled.is_undefined() && !is_3denabled.AsBool())); + } + + // Invalid instance cases. + Var result(pp::PASS_REF, + flash_interface_->GetSetting(0, PP_FLASHSETTING_3DENABLED)); + ASSERT_TRUE(result.is_undefined()); + result = Var(pp::PASS_REF, + flash_interface_->GetSetting(0, PP_FLASHSETTING_INCOGNITO)); + ASSERT_TRUE(result.is_undefined()); + result = Var(pp::PASS_REF, + flash_interface_->GetSetting(0, PP_FLASHSETTING_STAGE3DENABLED)); + ASSERT_TRUE(result.is_undefined()); + + PASS(); +} void TestFlash::QuitMessageLoopTask(int32_t) { flash_interface_->QuitMessageLoop(instance_->pp_instance()); diff --git a/ppapi/tests/test_flash.h b/ppapi/tests/test_flash.h index bd16930..602f5f0 100644 --- a/ppapi/tests/test_flash.h +++ b/ppapi/tests/test_flash.h @@ -30,6 +30,8 @@ class TestFlash : public TestCase { std::string TestGetLocalTimeZoneOffset(); std::string TestGetCommandLineArgs(); std::string TestGetDeviceID(); + std::string TestGetSettingInt(); + std::string TestGetSetting(); void QuitMessageLoopTask(int32_t); |