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