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 "content/renderer/browser_plugin/browser_plugin_browsertest.h" | 5 #include "content/renderer/browser_plugin/browser_plugin_browsertest.h" |
6 | 6 |
| 7 #include "base/debug/leak_annotations.h" |
7 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
8 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
9 #include "base/path_service.h" | 10 #include "base/path_service.h" |
10 #include "base/pickle.h" | 11 #include "base/pickle.h" |
11 #include "content/public/common/content_constants.h" | 12 #include "content/public/common/content_constants.h" |
12 #include "content/renderer/browser_plugin/browser_plugin.h" | 13 #include "content/renderer/browser_plugin/browser_plugin.h" |
13 #include "content/renderer/browser_plugin/browser_plugin_manager_factory.h" | 14 #include "content/renderer/browser_plugin/browser_plugin_manager_factory.h" |
14 #include "content/renderer/browser_plugin/mock_browser_plugin.h" | 15 #include "content/renderer/browser_plugin/mock_browser_plugin.h" |
15 #include "content/renderer/browser_plugin/mock_browser_plugin_manager.h" | 16 #include "content/renderer/browser_plugin/mock_browser_plugin_manager.h" |
16 #include "content/renderer/render_thread_impl.h" | 17 #include "content/renderer/render_thread_impl.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 test_content_renderer_client_.reset(new TestContentRendererClient); | 101 test_content_renderer_client_.reset(new TestContentRendererClient); |
101 SetRendererClientForTesting(test_content_renderer_client_.get()); | 102 SetRendererClientForTesting(test_content_renderer_client_.get()); |
102 BrowserPluginManager::set_factory_for_testing( | 103 BrowserPluginManager::set_factory_for_testing( |
103 TestBrowserPluginManagerFactory::GetInstance()); | 104 TestBrowserPluginManagerFactory::GetInstance()); |
104 content::RenderViewTest::SetUp(); | 105 content::RenderViewTest::SetUp(); |
105 } | 106 } |
106 | 107 |
107 void BrowserPluginTest::TearDown() { | 108 void BrowserPluginTest::TearDown() { |
108 BrowserPluginManager::set_factory_for_testing( | 109 BrowserPluginManager::set_factory_for_testing( |
109 TestBrowserPluginManagerFactory::GetInstance()); | 110 TestBrowserPluginManagerFactory::GetInstance()); |
| 111 #if defined(LEAK_SANITIZER) |
| 112 // Do this before shutting down V8 in RenderViewTest::TearDown(). |
| 113 // http://crbug.com/328552 |
| 114 __lsan_do_leak_check(); |
| 115 #endif |
110 content::RenderViewTest::TearDown(); | 116 content::RenderViewTest::TearDown(); |
111 test_content_renderer_client_.reset(); | 117 test_content_renderer_client_.reset(); |
112 } | 118 } |
113 | 119 |
114 std::string BrowserPluginTest::ExecuteScriptAndReturnString( | 120 std::string BrowserPluginTest::ExecuteScriptAndReturnString( |
115 const std::string& script) { | 121 const std::string& script) { |
116 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); | 122 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); |
117 v8::Handle<v8::Value> value = GetMainFrame()->executeScriptAndReturnValue( | 123 v8::Handle<v8::Value> value = GetMainFrame()->executeScriptAndReturnValue( |
118 blink::WebScriptSource(blink::WebString::fromUTF8(script.c_str()))); | 124 blink::WebScriptSource(blink::WebString::fromUTF8(script.c_str()))); |
119 if (value.IsEmpty() || !value->IsString()) | 125 if (value.IsEmpty() || !value->IsString()) |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 // These value are not populated (as an optimization) if autosize is | 636 // These value are not populated (as an optimization) if autosize is |
631 // disabled. | 637 // disabled. |
632 EXPECT_EQ(0, auto_size_params.min_size.width()); | 638 EXPECT_EQ(0, auto_size_params.min_size.width()); |
633 EXPECT_EQ(0, auto_size_params.min_size.height()); | 639 EXPECT_EQ(0, auto_size_params.min_size.height()); |
634 EXPECT_EQ(0, auto_size_params.max_size.width()); | 640 EXPECT_EQ(0, auto_size_params.max_size.width()); |
635 EXPECT_EQ(0, auto_size_params.max_size.height()); | 641 EXPECT_EQ(0, auto_size_params.max_size.height()); |
636 } | 642 } |
637 } | 643 } |
638 | 644 |
639 } // namespace content | 645 } // namespace content |
OLD | NEW |