| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/process/kill.h" | 13 #include "base/process/kill.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "chrome/browser/plugins/plugin_prefs.h" | 15 #include "chrome/browser/plugins/plugin_prefs.h" |
| 16 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 18 #include "chrome/test/base/in_process_browser_test.h" | 18 #include "chrome/test/base/in_process_browser_test.h" |
| 19 #include "chrome/test/base/ui_test_utils.h" | 19 #include "chrome/test/base/ui_test_utils.h" |
| 20 #include "content/public/browser/browser_child_process_host_iterator.h" | 20 #include "content/public/browser/browser_child_process_host_iterator.h" |
| 21 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 22 #include "content/public/browser/child_process_data.h" | 22 #include "content/public/browser/child_process_data.h" |
| 23 #include "content/public/browser/plugin_service.h" | 23 #include "content/public/browser/plugin_service.h" |
| 24 #include "content/public/common/content_constants.h" |
| 24 #include "content/public/common/content_paths.h" | 25 #include "content/public/common/content_paths.h" |
| 25 #include "content/public/common/process_type.h" | 26 #include "content/public/common/process_type.h" |
| 26 #include "content/public/common/webplugininfo.h" | 27 #include "content/public/common/webplugininfo.h" |
| 27 #include "content/public/test/browser_test_utils.h" | 28 #include "content/public/test/browser_test_utils.h" |
| 28 #include "content/public/test/test_utils.h" | 29 #include "content/public/test/test_utils.h" |
| 29 #include "net/base/net_util.h" | 30 #include "net/base/net_util.h" |
| 30 #include "webkit/plugins/plugin_constants.h" | |
| 31 | 31 |
| 32 using content::BrowserThread; | 32 using content::BrowserThread; |
| 33 | 33 |
| 34 namespace { | 34 namespace { |
| 35 | 35 |
| 36 class CallbackBarrier : public base::RefCountedThreadSafe<CallbackBarrier> { | 36 class CallbackBarrier : public base::RefCountedThreadSafe<CallbackBarrier> { |
| 37 public: | 37 public: |
| 38 explicit CallbackBarrier(const base::Closure& target_callback) | 38 explicit CallbackBarrier(const base::Closure& target_callback) |
| 39 : target_callback_(target_callback), | 39 : target_callback_(target_callback), |
| 40 outstanding_callbacks_(0), | 40 outstanding_callbacks_(0), |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 FROM_HERE, | 102 FROM_HERE, |
| 103 base::Bind(&CrashFlashInternal, runner->QuitClosure())); | 103 base::Bind(&CrashFlashInternal, runner->QuitClosure())); |
| 104 runner->Run(); | 104 runner->Run(); |
| 105 } | 105 } |
| 106 | 106 |
| 107 static void GetFlashPath(std::vector<base::FilePath>* paths) { | 107 static void GetFlashPath(std::vector<base::FilePath>* paths) { |
| 108 paths->clear(); | 108 paths->clear(); |
| 109 std::vector<content::WebPluginInfo> plugins = GetPlugins(); | 109 std::vector<content::WebPluginInfo> plugins = GetPlugins(); |
| 110 for (std::vector<content::WebPluginInfo>::const_iterator it = | 110 for (std::vector<content::WebPluginInfo>::const_iterator it = |
| 111 plugins.begin(); it != plugins.end(); ++it) { | 111 plugins.begin(); it != plugins.end(); ++it) { |
| 112 if (it->name == ASCIIToUTF16(kFlashPluginName)) | 112 if (it->name == ASCIIToUTF16(content::kFlashPluginName)) |
| 113 paths->push_back(it->path); | 113 paths->push_back(it->path); |
| 114 } | 114 } |
| 115 } | 115 } |
| 116 | 116 |
| 117 static std::vector<content::WebPluginInfo> GetPlugins() { | 117 static std::vector<content::WebPluginInfo> GetPlugins() { |
| 118 std::vector<content::WebPluginInfo> plugins; | 118 std::vector<content::WebPluginInfo> plugins; |
| 119 scoped_refptr<content::MessageLoopRunner> runner = | 119 scoped_refptr<content::MessageLoopRunner> runner = |
| 120 new content::MessageLoopRunner; | 120 new content::MessageLoopRunner; |
| 121 content::PluginService::GetInstance()->GetPlugins( | 121 content::PluginService::GetInstance()->GetPlugins( |
| 122 base::Bind(&GetPluginsInfoCallback, &plugins, runner->QuitClosure())); | 122 base::Bind(&GetPluginsInfoCallback, &plugins, runner->QuitClosure())); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 std::vector<content::WebPluginInfo> plugins = GetPlugins(); | 255 std::vector<content::WebPluginInfo> plugins = GetPlugins(); |
| 256 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(expected); ++i) { | 256 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(expected); ++i) { |
| 257 size_t j = 0; | 257 size_t j = 0; |
| 258 for (; j < plugins.size(); ++j) { | 258 for (; j < plugins.size(); ++j) { |
| 259 if (plugins[j].name == ASCIIToUTF16(expected[i])) | 259 if (plugins[j].name == ASCIIToUTF16(expected[i])) |
| 260 break; | 260 break; |
| 261 } | 261 } |
| 262 ASSERT_TRUE(j != plugins.size()) << "Didn't find " << expected[i]; | 262 ASSERT_TRUE(j != plugins.size()) << "Didn't find " << expected[i]; |
| 263 } | 263 } |
| 264 } | 264 } |
| OLD | NEW |