OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/memory/singleton.h" | 6 #include "base/memory/singleton.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginEmbedder); | 97 DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginEmbedder); |
98 }; | 98 }; |
99 | 99 |
100 // Test factory for creating test instances of BrowserPluginEmbedder and | 100 // Test factory for creating test instances of BrowserPluginEmbedder and |
101 // BrowserPluginGuest. | 101 // BrowserPluginGuest. |
102 class TestBrowserPluginHostFactory : public BrowserPluginHostFactory { | 102 class TestBrowserPluginHostFactory : public BrowserPluginHostFactory { |
103 public: | 103 public: |
104 virtual BrowserPluginGuestManager* | 104 virtual BrowserPluginGuestManager* |
105 CreateBrowserPluginGuestManager() OVERRIDE { | 105 CreateBrowserPluginGuestManager() OVERRIDE { |
106 guest_manager_instance_count_++; | 106 guest_manager_instance_count_++; |
107 if (message_loop_runner_.get()) | 107 if (message_loop_runner_) |
108 message_loop_runner_->Quit(); | 108 message_loop_runner_->Quit(); |
109 return new TestBrowserPluginGuestManager(); | 109 return new TestBrowserPluginGuestManager(); |
110 } | 110 } |
111 | 111 |
112 virtual BrowserPluginGuest* CreateBrowserPluginGuest( | 112 virtual BrowserPluginGuest* CreateBrowserPluginGuest( |
113 int instance_id, | 113 int instance_id, |
114 WebContentsImpl* web_contents) OVERRIDE { | 114 WebContentsImpl* web_contents) OVERRIDE { |
115 return new TestBrowserPluginGuest(instance_id, web_contents); | 115 return new TestBrowserPluginGuest(instance_id, web_contents); |
116 } | 116 } |
117 | 117 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 } | 200 } |
201 | 201 |
202 void ResetState() { | 202 void ResetState() { |
203 message_received_ = false; | 203 message_received_ = false; |
204 } | 204 } |
205 | 205 |
206 // IPC::Listener implementation. | 206 // IPC::Listener implementation. |
207 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { | 207 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { |
208 if (message.type() == message_id_) { | 208 if (message.type() == message_id_) { |
209 message_received_ = true; | 209 message_received_ = true; |
210 if (message_loop_runner_.get()) | 210 if (message_loop_runner_) |
211 message_loop_runner_->Quit(); | 211 message_loop_runner_->Quit(); |
212 } | 212 } |
213 return false; | 213 return false; |
214 } | 214 } |
215 | 215 |
216 private: | 216 private: |
217 scoped_refptr<MessageLoopRunner> message_loop_runner_; | 217 scoped_refptr<MessageLoopRunner> message_loop_runner_; |
218 uint32 message_id_; | 218 uint32 message_id_; |
219 bool message_received_; | 219 bool message_received_; |
220 | 220 |
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1061 scoped_ptr<base::Value> value = | 1061 scoped_ptr<base::Value> value = |
1062 content::ExecuteScriptAndGetValue( | 1062 content::ExecuteScriptAndGetValue( |
1063 guest_rfh, "document.getElementById('input1').value"); | 1063 guest_rfh, "document.getElementById('input1').value"); |
1064 std::string actual_value; | 1064 std::string actual_value; |
1065 ASSERT_TRUE(value->GetAsString(&actual_value)); | 1065 ASSERT_TRUE(value->GetAsString(&actual_value)); |
1066 EXPECT_EQ(base::UTF16ToUTF8(expected_value), actual_value); | 1066 EXPECT_EQ(base::UTF16ToUTF8(expected_value), actual_value); |
1067 } | 1067 } |
1068 } | 1068 } |
1069 | 1069 |
1070 } // namespace content | 1070 } // namespace content |
OLD | NEW |