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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/process_util.h" | 8 #include "base/process_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/plugins/plugin_prefs.h" | 10 #include "chrome/browser/plugins/plugin_prefs.h" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/browser_tabstrip.h" | 12 #include "chrome/browser/ui/browser_tabstrip.h" |
13 #include "chrome/test/base/in_process_browser_test.h" | 13 #include "chrome/test/base/in_process_browser_test.h" |
14 #include "chrome/test/base/ui_test_utils.h" | 14 #include "chrome/test/base/ui_test_utils.h" |
15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
16 #include "content/public/browser/browser_child_process_host_iterator.h" | 16 #include "content/public/browser/browser_child_process_host_iterator.h" |
17 #include "content/public/browser/child_process_data.h" | 17 #include "content/public/browser/child_process_data.h" |
18 #include "content/public/browser/plugin_service.h" | 18 #include "content/public/browser/plugin_service.h" |
19 #include "content/public/common/content_paths.h" | 19 #include "content/public/common/content_paths.h" |
20 #include "content/public/test/browser_test_utils.h" | 20 #include "content/public/test/browser_test_utils.h" |
21 #include "content/public/test/test_utils.h" | 21 #include "content/public/test/test_utils.h" |
22 #include "net/base/net_util.h" | 22 #include "net/base/net_util.h" |
| 23 #include "webkit/plugins/plugin_constants.h" |
23 #include "webkit/plugins/webplugininfo.h" | 24 #include "webkit/plugins/webplugininfo.h" |
24 | 25 |
25 using content::BrowserThread; | 26 using content::BrowserThread; |
26 | 27 |
27 class ChromePluginTest : public InProcessBrowserTest { | 28 class ChromePluginTest : public InProcessBrowserTest { |
28 protected: | 29 protected: |
29 ChromePluginTest() {} | 30 ChromePluginTest() {} |
30 | 31 |
31 static GURL GetURL(const char* filename) { | 32 static GURL GetURL(const char* filename) { |
32 FilePath path; | 33 FilePath path; |
(...skipping 21 matching lines...) Expand all Loading... |
54 BrowserThread::IO, | 55 BrowserThread::IO, |
55 FROM_HERE, | 56 FROM_HERE, |
56 base::Bind(&CrashFlashInternal, runner->QuitClosure())); | 57 base::Bind(&CrashFlashInternal, runner->QuitClosure())); |
57 runner->Run(); | 58 runner->Run(); |
58 } | 59 } |
59 | 60 |
60 static FilePath GetFlashPath() { | 61 static FilePath GetFlashPath() { |
61 std::vector<webkit::WebPluginInfo> plugins = GetPlugins(); | 62 std::vector<webkit::WebPluginInfo> plugins = GetPlugins(); |
62 for (std::vector<webkit::WebPluginInfo>::const_iterator it = | 63 for (std::vector<webkit::WebPluginInfo>::const_iterator it = |
63 plugins.begin(); it != plugins.end(); ++it) { | 64 plugins.begin(); it != plugins.end(); ++it) { |
64 if (it->name == ASCIIToUTF16("Shockwave Flash")) | 65 if (it->name == ASCIIToUTF16(kFlashPluginName)) |
65 return it->path; | 66 return it->path; |
66 } | 67 } |
67 return FilePath(); | 68 return FilePath(); |
68 } | 69 } |
69 | 70 |
70 static std::vector<webkit::WebPluginInfo> GetPlugins() { | 71 static std::vector<webkit::WebPluginInfo> GetPlugins() { |
71 std::vector<webkit::WebPluginInfo> plugins; | 72 std::vector<webkit::WebPluginInfo> plugins; |
72 scoped_refptr<content::MessageLoopRunner> runner = | 73 scoped_refptr<content::MessageLoopRunner> runner = |
73 new content::MessageLoopRunner; | 74 new content::MessageLoopRunner; |
74 content::PluginService::GetInstance()->GetPlugins( | 75 content::PluginService::GetInstance()->GetPlugins( |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 std::vector<webkit::WebPluginInfo> plugins = GetPlugins(); | 212 std::vector<webkit::WebPluginInfo> plugins = GetPlugins(); |
212 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(expected); ++i) { | 213 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(expected); ++i) { |
213 size_t j = 0; | 214 size_t j = 0; |
214 for (; j < plugins.size(); ++j) { | 215 for (; j < plugins.size(); ++j) { |
215 if (plugins[j].name == ASCIIToUTF16(expected[i])) | 216 if (plugins[j].name == ASCIIToUTF16(expected[i])) |
216 break; | 217 break; |
217 } | 218 } |
218 ASSERT_TRUE(j != plugins.size()) << "Didn't find " << expected[i]; | 219 ASSERT_TRUE(j != plugins.size()) << "Didn't find " << expected[i]; |
219 } | 220 } |
220 } | 221 } |
OLD | NEW |