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

Side by Side Diff: ppapi/tests/test_flash.cc

Issue 11413200: Refactored PPB_Flash GetSettings to the new pepper resource model (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
« no previous file with comments | « ppapi/shared_impl/scoped_pp_var.h ('k') | ppapi/thunk/ppb_flash_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ppapi/tests/test_flash.h" 5 #include "ppapi/tests/test_flash.h"
6 6
7 #include "ppapi/c/pp_macros.h" 7 #include "ppapi/c/pp_macros.h"
8 #include "ppapi/c/private/ppb_flash.h" 8 #include "ppapi/c/private/ppb_flash.h"
9 #include "ppapi/cpp/instance.h" 9 #include "ppapi/cpp/instance.h"
10 #include "ppapi/cpp/module.h" 10 #include "ppapi/cpp/module.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 70 }
71 71
72 std::string TestFlash::TestGetCommandLineArgs() { 72 std::string TestFlash::TestGetCommandLineArgs() {
73 Var result = Flash::GetCommandLineArgs(pp::Module::Get()); 73 Var result = Flash::GetCommandLineArgs(pp::Module::Get());
74 ASSERT_TRUE(result.is_string()); 74 ASSERT_TRUE(result.is_string());
75 75
76 PASS(); 76 PASS();
77 } 77 }
78 78
79 std::string TestFlash::TestGetSetting() { 79 std::string TestFlash::TestGetSetting() {
80 // This only works out of process. 80 Var is_3denabled = Flash::GetSetting(instance_, PP_FLASHSETTING_3DENABLED);
81 if (testing_interface_->IsOutOfProcess()) { 81 ASSERT_TRUE(is_3denabled.is_bool());
82 Var is_3denabled = Flash::GetSetting(instance_, PP_FLASHSETTING_3DENABLED);
83 ASSERT_TRUE(is_3denabled.is_bool());
84 82
85 Var is_incognito = Flash::GetSetting(instance_, PP_FLASHSETTING_INCOGNITO); 83 Var is_incognito = Flash::GetSetting(instance_, PP_FLASHSETTING_INCOGNITO);
86 ASSERT_TRUE(is_incognito.is_bool()); 84 ASSERT_TRUE(is_incognito.is_bool());
87 85
88 Var is_stage3denabled = Flash::GetSetting(instance_, 86 Var is_stage3denabled = Flash::GetSetting(instance_,
89 PP_FLASHSETTING_STAGE3DENABLED); 87 PP_FLASHSETTING_STAGE3DENABLED);
90 // This may "fail" if 3d isn't enabled. 88 // This may "fail" if 3d isn't enabled.
91 ASSERT_TRUE(is_stage3denabled.is_bool() || 89 ASSERT_TRUE(is_stage3denabled.is_bool() ||
92 (is_stage3denabled.is_undefined() && !is_3denabled.AsBool())); 90 (is_stage3denabled.is_undefined() && !is_3denabled.AsBool()));
93 91
94 Var num_cores = Flash::GetSetting(instance_, PP_FLASHSETTING_NUMCORES); 92 Var num_cores = Flash::GetSetting(instance_, PP_FLASHSETTING_NUMCORES);
95 ASSERT_TRUE(num_cores.is_int() && num_cores.AsInt() > 0); 93 ASSERT_TRUE(num_cores.is_int() && num_cores.AsInt() > 0);
96 } 94
95 Var lso_restrictions = Flash::GetSetting(instance_,
96 PP_FLASHSETTING_LSORESTRICTIONS);
97 ASSERT_TRUE(lso_restrictions.is_int());
98 int32_t lso_restrictions_int = lso_restrictions.AsInt();
99 ASSERT_TRUE(lso_restrictions_int == PP_FLASHLSORESTRICTIONS_NONE ||
100 lso_restrictions_int == PP_FLASHLSORESTRICTIONS_BLOCK ||
101 lso_restrictions_int == PP_FLASHLSORESTRICTIONS_IN_MEMORY);
97 102
98 // Invalid instance cases. 103 // Invalid instance cases.
99 Var result = Flash::GetSetting( 104 Var result = Flash::GetSetting(
100 pp::InstanceHandle(static_cast<PP_Instance>(0)), 105 pp::InstanceHandle(static_cast<PP_Instance>(0)),
101 PP_FLASHSETTING_3DENABLED); 106 PP_FLASHSETTING_3DENABLED);
102 ASSERT_TRUE(result.is_undefined()); 107 ASSERT_TRUE(result.is_undefined());
103 result = Flash::GetSetting(pp::InstanceHandle(static_cast<PP_Instance>(0)), 108 result = Flash::GetSetting(pp::InstanceHandle(static_cast<PP_Instance>(0)),
104 PP_FLASHSETTING_INCOGNITO); 109 PP_FLASHSETTING_INCOGNITO);
105 ASSERT_TRUE(result.is_undefined()); 110 ASSERT_TRUE(result.is_undefined());
106 result = Flash::GetSetting(pp::InstanceHandle(static_cast<PP_Instance>(0)), 111 result = Flash::GetSetting(pp::InstanceHandle(static_cast<PP_Instance>(0)),
107 PP_FLASHSETTING_STAGE3DENABLED); 112 PP_FLASHSETTING_STAGE3DENABLED);
108 ASSERT_TRUE(result.is_undefined()); 113 ASSERT_TRUE(result.is_undefined());
109 114
110 PASS(); 115 PASS();
111 } 116 }
112 117
113 std::string TestFlash::TestSetCrashData() { 118 std::string TestFlash::TestSetCrashData() {
114 pp::Var url("http://..."); 119 pp::Var url("http://...");
115 ASSERT_TRUE(Flash::SetCrashData(instance_, PP_FLASHCRASHKEY_URL, url)); 120 ASSERT_TRUE(Flash::SetCrashData(instance_, PP_FLASHCRASHKEY_URL, url));
116 121
117 PASS(); 122 PASS();
118 } 123 }
OLDNEW
« no previous file with comments | « ppapi/shared_impl/scoped_pp_var.h ('k') | ppapi/thunk/ppb_flash_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698