Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1204)

Side by Side Diff: content/renderer/browser_plugin/browser_plugin_browsertest.cc

Issue 63253002: Rename WebKit namespace to blink (part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/pickle.h" 10 #include "base/pickle.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 namespace content { 55 namespace content {
56 56
57 class TestContentRendererClient : public ContentRendererClient { 57 class TestContentRendererClient : public ContentRendererClient {
58 public: 58 public:
59 TestContentRendererClient() : ContentRendererClient() { 59 TestContentRendererClient() : ContentRendererClient() {
60 } 60 }
61 virtual ~TestContentRendererClient() { 61 virtual ~TestContentRendererClient() {
62 } 62 }
63 virtual bool AllowBrowserPlugin( 63 virtual bool AllowBrowserPlugin(
64 WebKit::WebPluginContainer* container) OVERRIDE { 64 blink::WebPluginContainer* container) OVERRIDE {
65 // Allow BrowserPlugin for tests. 65 // Allow BrowserPlugin for tests.
66 return true; 66 return true;
67 } 67 }
68 }; 68 };
69 69
70 // Test factory for creating test instances of BrowserPluginManager. 70 // Test factory for creating test instances of BrowserPluginManager.
71 class TestBrowserPluginManagerFactory : public BrowserPluginManagerFactory { 71 class TestBrowserPluginManagerFactory : public BrowserPluginManagerFactory {
72 public: 72 public:
73 virtual MockBrowserPluginManager* CreateBrowserPluginManager( 73 virtual MockBrowserPluginManager* CreateBrowserPluginManager(
74 RenderViewImpl* render_view) OVERRIDE { 74 RenderViewImpl* render_view) OVERRIDE {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 BrowserPluginManager::set_factory_for_testing( 107 BrowserPluginManager::set_factory_for_testing(
108 TestBrowserPluginManagerFactory::GetInstance()); 108 TestBrowserPluginManagerFactory::GetInstance());
109 content::RenderViewTest::TearDown(); 109 content::RenderViewTest::TearDown();
110 test_content_renderer_client_.reset(); 110 test_content_renderer_client_.reset();
111 } 111 }
112 112
113 std::string BrowserPluginTest::ExecuteScriptAndReturnString( 113 std::string BrowserPluginTest::ExecuteScriptAndReturnString(
114 const std::string& script) { 114 const std::string& script) {
115 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); 115 v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
116 v8::Handle<v8::Value> value = GetMainFrame()->executeScriptAndReturnValue( 116 v8::Handle<v8::Value> value = GetMainFrame()->executeScriptAndReturnValue(
117 WebKit::WebScriptSource(WebKit::WebString::fromUTF8(script.c_str()))); 117 blink::WebScriptSource(blink::WebString::fromUTF8(script.c_str())));
118 if (value.IsEmpty() || !value->IsString()) 118 if (value.IsEmpty() || !value->IsString())
119 return std::string(); 119 return std::string();
120 120
121 v8::Local<v8::String> v8_str = value->ToString(); 121 v8::Local<v8::String> v8_str = value->ToString();
122 int length = v8_str->Utf8Length() + 1; 122 int length = v8_str->Utf8Length() + 1;
123 scoped_ptr<char[]> str(new char[length]); 123 scoped_ptr<char[]> str(new char[length]);
124 v8_str->WriteUtf8(str.get(), length); 124 v8_str->WriteUtf8(str.get(), length);
125 return str.get(); 125 return str.get();
126 } 126 }
127 127
128 int BrowserPluginTest::ExecuteScriptAndReturnInt( 128 int BrowserPluginTest::ExecuteScriptAndReturnInt(
129 const std::string& script) { 129 const std::string& script) {
130 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); 130 v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
131 v8::Handle<v8::Value> value = GetMainFrame()->executeScriptAndReturnValue( 131 v8::Handle<v8::Value> value = GetMainFrame()->executeScriptAndReturnValue(
132 WebKit::WebScriptSource(WebKit::WebString::fromUTF8(script.c_str()))); 132 blink::WebScriptSource(blink::WebString::fromUTF8(script.c_str())));
133 if (value.IsEmpty() || !value->IsInt32()) 133 if (value.IsEmpty() || !value->IsInt32())
134 return 0; 134 return 0;
135 135
136 return value->Int32Value(); 136 return value->Int32Value();
137 } 137 }
138 138
139 // A return value of false means that a value was not present. The return value 139 // A return value of false means that a value was not present. The return value
140 // of the script is stored in |result| 140 // of the script is stored in |result|
141 bool BrowserPluginTest::ExecuteScriptAndReturnBool( 141 bool BrowserPluginTest::ExecuteScriptAndReturnBool(
142 const std::string& script, bool* result) { 142 const std::string& script, bool* result) {
143 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); 143 v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
144 v8::Handle<v8::Value> value = GetMainFrame()->executeScriptAndReturnValue( 144 v8::Handle<v8::Value> value = GetMainFrame()->executeScriptAndReturnValue(
145 WebKit::WebScriptSource(WebKit::WebString::fromUTF8(script.c_str()))); 145 blink::WebScriptSource(blink::WebString::fromUTF8(script.c_str())));
146 if (value.IsEmpty() || !value->IsBoolean()) 146 if (value.IsEmpty() || !value->IsBoolean())
147 return false; 147 return false;
148 148
149 *result = value->BooleanValue(); 149 *result = value->BooleanValue();
150 return true; 150 return true;
151 } 151 }
152 152
153 MockBrowserPlugin* BrowserPluginTest::GetCurrentPlugin() { 153 MockBrowserPlugin* BrowserPluginTest::GetCurrentPlugin() {
154 BrowserPluginHostMsg_Attach_Params params; 154 BrowserPluginHostMsg_Attach_Params params;
155 return GetCurrentPluginWithAttachParams(&params); 155 return GetCurrentPluginWithAttachParams(&params);
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 // These value are not populated (as an optimization) if autosize is 623 // These value are not populated (as an optimization) if autosize is
624 // disabled. 624 // disabled.
625 EXPECT_EQ(0, auto_size_params.min_size.width()); 625 EXPECT_EQ(0, auto_size_params.min_size.width());
626 EXPECT_EQ(0, auto_size_params.min_size.height()); 626 EXPECT_EQ(0, auto_size_params.min_size.height());
627 EXPECT_EQ(0, auto_size_params.max_size.width()); 627 EXPECT_EQ(0, auto_size_params.max_size.width());
628 EXPECT_EQ(0, auto_size_params.max_size.height()); 628 EXPECT_EQ(0, auto_size_params.max_size.height());
629 } 629 }
630 } 630 }
631 631
632 } // namespace content 632 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698