Index: content/shell/renderer/test_runner/test_runner.cc |
diff --git a/content/shell/renderer/test_runner/test_runner.cc b/content/shell/renderer/test_runner/test_runner.cc |
index d56795220cd3c76edf3ade0975ceed119dc5aeab..9f6fceab942753885b858be5359b868ea84577be 100644 |
--- a/content/shell/renderer/test_runner/test_runner.cc |
+++ b/content/shell/renderer/test_runner/test_runner.cc |
@@ -40,6 +40,7 @@ |
#include "third_party/WebKit/public/web/WebGraphicsContext.h" |
#include "third_party/WebKit/public/web/WebInputElement.h" |
#include "third_party/WebKit/public/web/WebKit.h" |
+#include "third_party/WebKit/public/web/WebLocalFrame.h" |
#include "third_party/WebKit/public/web/WebMIDIClientMock.h" |
#include "third_party/WebKit/public/web/WebPageOverlay.h" |
#include "third_party/WebKit/public/web/WebScriptSource.h" |
@@ -187,6 +188,7 @@ class TestRunnerBindings : public gin::Wrappable<TestRunnerBindings> { |
bool HasCustomPageSizeStyle(int page_index); |
void ForceRedSelectionColors(); |
void InjectStyleSheet(const std::string& source_code, bool all_frames); |
+ void InsertStyleSheet(const std::string& source_code); |
bool FindString(const std::string& search_text, |
const std::vector<std::string>& options_array); |
std::string SelectionAsMarkup(); |
@@ -394,6 +396,7 @@ gin::ObjectTemplateBuilder TestRunnerBindings::GetObjectTemplateBuilder( |
.SetMethod("forceRedSelectionColors", |
&TestRunnerBindings::ForceRedSelectionColors) |
.SetMethod("injectStyleSheet", &TestRunnerBindings::InjectStyleSheet) |
+ .SetMethod("insertStyleSheet", &TestRunnerBindings::InsertStyleSheet) |
.SetMethod("findString", &TestRunnerBindings::FindString) |
.SetMethod("selectionAsMarkup", &TestRunnerBindings::SelectionAsMarkup) |
.SetMethod("setTextSubpixelPositioning", |
@@ -800,6 +803,11 @@ void TestRunnerBindings::InjectStyleSheet(const std::string& source_code, |
runner_->InjectStyleSheet(source_code, all_frames); |
} |
+void TestRunnerBindings::InsertStyleSheet(const std::string& source_code) { |
+ if (runner_) |
+ runner_->InsertStyleSheet(source_code); |
+} |
+ |
bool TestRunnerBindings::FindString( |
const std::string& search_text, |
const std::vector<std::string>& options_array) { |
@@ -2274,6 +2282,11 @@ void TestRunner::InjectStyleSheet(const std::string& source_code, |
: WebView::InjectStyleInTopFrameOnly); |
} |
+void TestRunner::InsertStyleSheet(const std::string& source_code) { |
+ WebLocalFrame::frameForCurrentContext()->document().insertStyleSheet( |
+ WebString::fromUTF8(source_code)); |
+} |
+ |
bool TestRunner::FindString(const std::string& search_text, |
const std::vector<std::string>& options_array) { |
WebFindOptions find_options; |