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/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "content/common/browser_plugin_messages.h" | 10 #include "content/common/browser_plugin_messages.h" |
11 #include "content/public/common/content_constants.h" | 11 #include "content/public/common/content_constants.h" |
12 #include "content/renderer/browser_plugin/browser_plugin.h" | 12 #include "content/renderer/browser_plugin/browser_plugin.h" |
13 #include "content/renderer/browser_plugin/mock_browser_plugin.h" | 13 #include "content/renderer/browser_plugin/mock_browser_plugin.h" |
14 #include "content/renderer/browser_plugin/mock_browser_plugin_manager.h" | 14 #include "content/renderer/browser_plugin/mock_browser_plugin_manager.h" |
15 #include "content/renderer/render_thread_impl.h" | 15 #include "content/renderer/render_thread_impl.h" |
16 #include "content/renderer/renderer_webkitplatformsupport_impl.h" | 16 #include "content/renderer/renderer_webkitplatformsupport_impl.h" |
| 17 #include "content/shell/shell_main_delegate.h" |
17 #include "skia/ext/platform_canvas.h" | 18 #include "skia/ext/platform_canvas.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" |
21 | 22 |
22 namespace { | 23 namespace { |
23 const char kHTMLForBrowserPluginObject[] = | 24 const char kHTMLForBrowserPluginObject[] = |
24 "<object id='browserplugin' width='640px' height='480px'" | 25 "<object id='browserplugin' width='640px' height='480px'" |
25 " src='foo' type='%s'>"; | 26 " src='foo' type='%s'>"; |
26 | 27 |
(...skipping 18 matching lines...) Expand all Loading... |
45 namespace content { | 46 namespace content { |
46 | 47 |
47 BrowserPluginTest::BrowserPluginTest() {} | 48 BrowserPluginTest::BrowserPluginTest() {} |
48 | 49 |
49 BrowserPluginTest::~BrowserPluginTest() {} | 50 BrowserPluginTest::~BrowserPluginTest() {} |
50 | 51 |
51 void BrowserPluginTest::SetUp() { | 52 void BrowserPluginTest::SetUp() { |
52 GetContentClient()->set_renderer_for_testing(&content_renderer_client_); | 53 GetContentClient()->set_renderer_for_testing(&content_renderer_client_); |
53 content::RenderViewTest::SetUp(); | 54 content::RenderViewTest::SetUp(); |
54 browser_plugin_manager_.reset(new MockBrowserPluginManager()); | 55 browser_plugin_manager_.reset(new MockBrowserPluginManager()); |
| 56 content::ShellMainDelegate::InitializeResourceBundle(); |
55 } | 57 } |
56 | 58 |
57 void BrowserPluginTest::TearDown() { | 59 void BrowserPluginTest::TearDown() { |
58 browser_plugin_manager_->Cleanup(); | 60 browser_plugin_manager_->Cleanup(); |
59 content::RenderViewTest::TearDown(); | 61 content::RenderViewTest::TearDown(); |
60 } | 62 } |
61 | 63 |
62 std::string BrowserPluginTest::ExecuteScriptAndReturnString( | 64 std::string BrowserPluginTest::ExecuteScriptAndReturnString( |
63 const std::string& script) { | 65 const std::string& script) { |
64 v8::Handle<v8::Value> value = GetMainFrame()->executeScriptAndReturnValue( | 66 v8::Handle<v8::Value> value = GetMainFrame()->executeScriptAndReturnValue( |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 EXPECT_STREQ( | 483 EXPECT_STREQ( |
482 "The object has already navigated, so its partition cannot be changed.", | 484 "The object has already navigated, so its partition cannot be changed.", |
483 title.c_str()); | 485 title.c_str()); |
484 | 486 |
485 partition_value = ExecuteScriptAndReturnString( | 487 partition_value = ExecuteScriptAndReturnString( |
486 "document.getElementById('browserplugin').partition"); | 488 "document.getElementById('browserplugin').partition"); |
487 EXPECT_STREQ("storage", partition_value.c_str()); | 489 EXPECT_STREQ("storage", partition_value.c_str()); |
488 } | 490 } |
489 | 491 |
490 } // namespace content | 492 } // namespace content |
OLD | NEW |