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

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

Issue 9381010: Convert resources to take an instance key instead of an Instance*. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: USELESS PATCH TITLE Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « ppapi/tests/test_char_set.cc ('k') | ppapi/tests/test_flash_clipboard.cc » ('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) 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
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 }
OLDNEW
« no previous file with comments | « ppapi/tests/test_char_set.cc ('k') | ppapi/tests/test_flash_clipboard.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698