OLD | NEW |
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 "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "content/common/view_messages.h" | 7 #include "content/common/view_messages.h" |
8 #include "content/public/common/file_chooser_file_info.h" | 8 #include "content/public/common/file_chooser_file_info.h" |
9 #include "content/public/common/file_chooser_params.h" | 9 #include "content/public/common/file_chooser_params.h" |
10 #include "content/public/test/render_view_test.h" | 10 #include "content/public/test/render_view_test.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 namespace { | 30 namespace { |
31 | 31 |
32 class PepperFileChooserHostTest : public RenderViewTest { | 32 class PepperFileChooserHostTest : public RenderViewTest { |
33 public: | 33 public: |
34 PepperFileChooserHostTest() : pp_instance_(123456) {} | 34 PepperFileChooserHostTest() : pp_instance_(123456) {} |
35 | 35 |
36 void SetUp() override { | 36 void SetUp() override { |
37 SetContentClient(&client_); | 37 SetContentClient(&client_); |
38 RenderViewTest::SetUp(); | 38 RenderViewTest::SetUp(); |
39 ppapi::ProxyLock::DisableLockingOnThreadForTest(); | |
40 | 39 |
41 globals_.GetResourceTracker()->DidCreateInstance(pp_instance_); | 40 globals_.GetResourceTracker()->DidCreateInstance(pp_instance_); |
42 } | 41 } |
43 void TearDown() override { | 42 void TearDown() override { |
44 globals_.GetResourceTracker()->DidDeleteInstance(pp_instance_); | 43 globals_.GetResourceTracker()->DidDeleteInstance(pp_instance_); |
45 | 44 |
46 RenderViewTest::TearDown(); | 45 RenderViewTest::TearDown(); |
47 } | 46 } |
48 | 47 |
49 PP_Instance pp_instance() const { return pp_instance_; } | 48 PP_Instance pp_instance() const { return pp_instance_; } |
50 | 49 |
51 private: | 50 private: |
52 PP_Instance pp_instance_; | 51 PP_Instance pp_instance_; |
53 | 52 |
| 53 // Disables locking for the duration of the test. |
| 54 ppapi::ProxyLock::LockingDisablerForTest disable_locking_; |
54 ppapi::TestGlobals globals_; | 55 ppapi::TestGlobals globals_; |
55 TestContentClient client_; | 56 TestContentClient client_; |
56 }; | 57 }; |
57 | 58 |
58 // For testing to convert our hardcoded file paths to 8-bit. | 59 // For testing to convert our hardcoded file paths to 8-bit. |
59 std::string FilePathToUTF8(const base::FilePath::StringType& path) { | 60 std::string FilePathToUTF8(const base::FilePath::StringType& path) { |
60 #if defined(OS_WIN) | 61 #if defined(OS_WIN) |
61 return base::UTF16ToUTF8(path); | 62 return base::UTF16ToUTF8(path); |
62 #else | 63 #else |
63 return path; | 64 return path; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 accept.push_back("text/plain"); | 143 accept.push_back("text/plain"); |
143 PpapiHostMsg_FileChooser_Show show_msg(false, false, std::string(), accept); | 144 PpapiHostMsg_FileChooser_Show show_msg(false, false, std::string(), accept); |
144 | 145 |
145 ppapi::proxy::ResourceMessageCallParams call_params(pp_resource, 0); | 146 ppapi::proxy::ResourceMessageCallParams call_params(pp_resource, 0); |
146 ppapi::host::HostMessageContext context(call_params); | 147 ppapi::host::HostMessageContext context(call_params); |
147 int32 result = chooser.OnResourceMessageReceived(show_msg, &context); | 148 int32 result = chooser.OnResourceMessageReceived(show_msg, &context); |
148 EXPECT_EQ(PP_ERROR_NO_USER_GESTURE, result); | 149 EXPECT_EQ(PP_ERROR_NO_USER_GESTURE, result); |
149 } | 150 } |
150 | 151 |
151 } // namespace content | 152 } // namespace content |
OLD | NEW |