OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 23 matching lines...) Expand all Loading... |
34 RUN_TEST(GetCommandLineArgs, filter); | 34 RUN_TEST(GetCommandLineArgs, filter); |
35 } | 35 } |
36 | 36 |
37 std::string TestFlash::TestSetInstanceAlwaysOnTop() { | 37 std::string TestFlash::TestSetInstanceAlwaysOnTop() { |
38 flash_interface_->SetInstanceAlwaysOnTop(instance_->pp_instance(), PP_TRUE); | 38 flash_interface_->SetInstanceAlwaysOnTop(instance_->pp_instance(), PP_TRUE); |
39 flash_interface_->SetInstanceAlwaysOnTop(instance_->pp_instance(), PP_FALSE); | 39 flash_interface_->SetInstanceAlwaysOnTop(instance_->pp_instance(), PP_FALSE); |
40 PASS(); | 40 PASS(); |
41 } | 41 } |
42 | 42 |
43 std::string TestFlash::TestGetProxyForURL() { | 43 std::string TestFlash::TestGetProxyForURL() { |
44 Var result(Var::PassRef(), | 44 Var result(pp::PASS_REF, |
45 flash_interface_->GetProxyForURL(instance_->pp_instance(), | 45 flash_interface_->GetProxyForURL(instance_->pp_instance(), |
46 "http://127.0.0.1/foobar/")); | 46 "http://127.0.0.1/foobar/")); |
47 ASSERT_TRUE(result.is_string()); | 47 ASSERT_TRUE(result.is_string()); |
48 // Assume no one configures a proxy for localhost. | 48 // Assume no one configures a proxy for localhost. |
49 ASSERT_EQ("DIRECT", result.AsString()); | 49 ASSERT_EQ("DIRECT", result.AsString()); |
50 | 50 |
51 result = Var(Var::PassRef(), | 51 result = Var(pp::PASS_REF, |
52 flash_interface_->GetProxyForURL(instance_->pp_instance(), | 52 flash_interface_->GetProxyForURL(instance_->pp_instance(), |
53 "http://www.google.com")); | 53 "http://www.google.com")); |
54 // Don't know what the proxy might be, but it should be a valid result. | 54 // Don't know what the proxy might be, but it should be a valid result. |
55 ASSERT_TRUE(result.is_string()); | 55 ASSERT_TRUE(result.is_string()); |
56 | 56 |
57 result = Var(Var::PassRef(), | 57 result = Var(pp::PASS_REF, |
58 flash_interface_->GetProxyForURL(instance_->pp_instance(), | 58 flash_interface_->GetProxyForURL(instance_->pp_instance(), |
59 "file:///tmp")); | 59 "file:///tmp")); |
60 ASSERT_TRUE(result.is_string()); | 60 ASSERT_TRUE(result.is_string()); |
61 // Should get "DIRECT" for file:// URLs. | 61 // Should get "DIRECT" for file:// URLs. |
62 ASSERT_EQ("DIRECT", result.AsString()); | 62 ASSERT_EQ("DIRECT", result.AsString()); |
63 | 63 |
64 result = Var(Var::PassRef(), | 64 result = Var(pp::PASS_REF, |
65 flash_interface_->GetProxyForURL(instance_->pp_instance(), | 65 flash_interface_->GetProxyForURL(instance_->pp_instance(), |
66 "this_isnt_an_url")); | 66 "this_isnt_an_url")); |
67 // Should be an error. | 67 // Should be an error. |
68 ASSERT_TRUE(result.is_undefined()); | 68 ASSERT_TRUE(result.is_undefined()); |
69 | 69 |
70 PASS(); | 70 PASS(); |
71 } | 71 } |
72 | 72 |
73 std::string TestFlash::TestMessageLoop() { | 73 std::string TestFlash::TestMessageLoop() { |
74 pp::CompletionCallback callback = | 74 pp::CompletionCallback callback = |
75 callback_factory_.NewRequiredCallback(&TestFlash::QuitMessageLoopTask); | 75 callback_factory_.NewRequiredCallback(&TestFlash::QuitMessageLoopTask); |
76 pp::Module::Get()->core()->CallOnMainThread(0, callback); | 76 pp::Module::Get()->core()->CallOnMainThread(0, callback); |
77 flash_interface_->RunMessageLoop(instance_->pp_instance()); | 77 flash_interface_->RunMessageLoop(instance_->pp_instance()); |
78 | 78 |
79 PASS(); | 79 PASS(); |
80 } | 80 } |
81 | 81 |
82 std::string TestFlash::TestGetLocalTimeZoneOffset() { | 82 std::string TestFlash::TestGetLocalTimeZoneOffset() { |
83 double result = flash_interface_->GetLocalTimeZoneOffset( | 83 double result = flash_interface_->GetLocalTimeZoneOffset( |
84 instance_->pp_instance(), 1321491298.0); | 84 instance_->pp_instance(), 1321491298.0); |
85 // The result depends on the local time zone, but +/- 14h from UTC should | 85 // The result depends on the local time zone, but +/- 14h from UTC should |
86 // cover the possibilities. | 86 // cover the possibilities. |
87 ASSERT_TRUE(result >= -14 * 60 * 60); | 87 ASSERT_TRUE(result >= -14 * 60 * 60); |
88 ASSERT_TRUE(result <= 14 * 60 * 60); | 88 ASSERT_TRUE(result <= 14 * 60 * 60); |
89 | 89 |
90 PASS(); | 90 PASS(); |
91 } | 91 } |
92 | 92 |
93 std::string TestFlash::TestGetCommandLineArgs() { | 93 std::string TestFlash::TestGetCommandLineArgs() { |
94 Var result(Var::PassRef(), | 94 Var result(pp::PASS_REF, |
95 flash_interface_->GetCommandLineArgs( | 95 flash_interface_->GetCommandLineArgs( |
96 pp::Module::Get()->pp_module())); | 96 pp::Module::Get()->pp_module())); |
97 ASSERT_TRUE(result.is_string()); | 97 ASSERT_TRUE(result.is_string()); |
98 | 98 |
99 PASS(); | 99 PASS(); |
100 } | 100 } |
101 | 101 |
102 void TestFlash::QuitMessageLoopTask(int32_t) { | 102 void TestFlash::QuitMessageLoopTask(int32_t) { |
103 flash_interface_->QuitMessageLoop(instance_->pp_instance()); | 103 flash_interface_->QuitMessageLoop(instance_->pp_instance()); |
104 } | 104 } |
OLD | NEW |