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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_host_browsertest.cc

Issue 120313002: Use stub GL draw/clear calls for browser tests that do not need pixels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: stubgl: use_osmesa Created 6 years, 11 months 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
« no previous file with comments | « chrome/test/ppapi/ppapi_test.cc ('k') | content/browser/media/media_browsertest.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 test_guest_manager_(NULL) {} 218 test_guest_manager_(NULL) {}
219 219
220 virtual void SetUp() OVERRIDE { 220 virtual void SetUp() OVERRIDE {
221 // Override factory to create tests instances of BrowserPlugin*. 221 // Override factory to create tests instances of BrowserPlugin*.
222 content::BrowserPluginEmbedder::set_factory_for_testing( 222 content::BrowserPluginEmbedder::set_factory_for_testing(
223 TestBrowserPluginHostFactory::GetInstance()); 223 TestBrowserPluginHostFactory::GetInstance());
224 content::BrowserPluginGuest::set_factory_for_testing( 224 content::BrowserPluginGuest::set_factory_for_testing(
225 TestBrowserPluginHostFactory::GetInstance()); 225 TestBrowserPluginHostFactory::GetInstance());
226 content::BrowserPluginGuestManager::set_factory_for_testing( 226 content::BrowserPluginGuestManager::set_factory_for_testing(
227 TestBrowserPluginHostFactory::GetInstance()); 227 TestBrowserPluginHostFactory::GetInstance());
228
229 // We need real contexts, otherwise the embedder doesn't composite, but the
230 // guest does, and that isn't an expected configuration.
231 UseRealGLContexts();
232
233 ContentBrowserTest::SetUp(); 228 ContentBrowserTest::SetUp();
234 } 229 }
235 virtual void TearDown() OVERRIDE { 230 virtual void TearDown() OVERRIDE {
236 content::BrowserPluginEmbedder::set_factory_for_testing(NULL); 231 content::BrowserPluginEmbedder::set_factory_for_testing(NULL);
237 content::BrowserPluginGuest::set_factory_for_testing(NULL); 232 content::BrowserPluginGuest::set_factory_for_testing(NULL);
238 233
239 ContentBrowserTest::TearDown(); 234 ContentBrowserTest::TearDown();
240 } 235 }
241 236
242 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 237 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 // Tests involving the threaded compositor. 806 // Tests involving the threaded compositor.
812 class BrowserPluginThreadedCompositorTest : public BrowserPluginHostTest { 807 class BrowserPluginThreadedCompositorTest : public BrowserPluginHostTest {
813 public: 808 public:
814 BrowserPluginThreadedCompositorTest() {} 809 BrowserPluginThreadedCompositorTest() {}
815 virtual ~BrowserPluginThreadedCompositorTest() {} 810 virtual ~BrowserPluginThreadedCompositorTest() {}
816 811
817 protected: 812 protected:
818 virtual void SetUpCommandLine(CommandLine* cmd) OVERRIDE { 813 virtual void SetUpCommandLine(CommandLine* cmd) OVERRIDE {
819 BrowserPluginHostTest::SetUpCommandLine(cmd); 814 BrowserPluginHostTest::SetUpCommandLine(cmd);
820 cmd->AppendSwitch(switches::kEnableThreadedCompositing); 815 cmd->AppendSwitch(switches::kEnableThreadedCompositing);
816 }
817 };
821 818
819 class BrowserPluginThreadedCompositorPixelTest
820 : public BrowserPluginThreadedCompositorTest {
821 protected:
822 virtual void SetUp() OVERRIDE {
823 UseRealGLContexts();
824 BrowserPluginThreadedCompositorTest::SetUp();
825 }
826
827 virtual void SetUpCommandLine(CommandLine* cmd) OVERRIDE {
828 BrowserPluginThreadedCompositorTest::SetUpCommandLine(cmd);
822 // http://crbug.com/327035 829 // http://crbug.com/327035
823 cmd->AppendSwitch(switches::kDisableDelegatedRenderer); 830 cmd->AppendSwitch(switches::kDisableDelegatedRenderer);
824 } 831 }
825 }; 832 };
826 833
827 static void CompareSkBitmaps(const SkBitmap& expected_bitmap, 834 static void CompareSkBitmaps(const SkBitmap& expected_bitmap,
828 const SkBitmap& bitmap) { 835 const SkBitmap& bitmap) {
829 EXPECT_EQ(expected_bitmap.width(), bitmap.width()); 836 EXPECT_EQ(expected_bitmap.width(), bitmap.width());
830 if (expected_bitmap.width() != bitmap.width()) 837 if (expected_bitmap.width() != bitmap.width())
831 return; 838 return;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 CompareSkBitmaps(expected_bitmap, bitmap); 894 CompareSkBitmaps(expected_bitmap, bitmap);
888 callback.Run(); 895 callback.Run();
889 } 896 }
890 897
891 // http://crbug.com/171744 898 // http://crbug.com/171744
892 #if defined(OS_MACOSX) 899 #if defined(OS_MACOSX)
893 #define MAYBE_GetBackingStore DISABLED_GetBackingStore 900 #define MAYBE_GetBackingStore DISABLED_GetBackingStore
894 #else 901 #else
895 #define MAYBE_GetBackingStore GetBackingStore 902 #define MAYBE_GetBackingStore GetBackingStore
896 #endif 903 #endif
897 IN_PROC_BROWSER_TEST_F(BrowserPluginThreadedCompositorTest, 904 IN_PROC_BROWSER_TEST_F(BrowserPluginThreadedCompositorPixelTest,
898 MAYBE_GetBackingStore) { 905 MAYBE_GetBackingStore) {
899 const char kEmbedderURL[] = "/browser_plugin_embedder.html"; 906 const char kEmbedderURL[] = "/browser_plugin_embedder.html";
900 const char kHTMLForGuest[] = 907 const char kHTMLForGuest[] =
901 "data:text/html,<html><style>body { background-color: red; }</style>" 908 "data:text/html,<html><style>body { background-color: red; }</style>"
902 "<body></body></html>"; 909 "<body></body></html>";
903 StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, 910 StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true,
904 std::string("SetSize(50, 60);")); 911 std::string("SetSize(50, 60);"));
905 912
906 WebContentsImpl* guest_contents = test_guest()->web_contents(); 913 WebContentsImpl* guest_contents = test_guest()->web_contents();
907 RenderWidgetHostImpl* guest_widget_host = 914 RenderWidgetHostImpl* guest_widget_host =
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 scoped_ptr<base::Value> value = 1034 scoped_ptr<base::Value> value =
1028 content::ExecuteScriptAndGetValue( 1035 content::ExecuteScriptAndGetValue(
1029 guest_rvh, "document.getElementById('input1').value"); 1036 guest_rvh, "document.getElementById('input1').value");
1030 std::string actual_value; 1037 std::string actual_value;
1031 ASSERT_TRUE(value->GetAsString(&actual_value)); 1038 ASSERT_TRUE(value->GetAsString(&actual_value));
1032 EXPECT_EQ(base::UTF16ToUTF8(expected_value), actual_value); 1039 EXPECT_EQ(base::UTF16ToUTF8(expected_value), actual_value);
1033 } 1040 }
1034 } 1041 }
1035 1042
1036 } // namespace content 1043 } // namespace content
OLDNEW
« no previous file with comments | « chrome/test/ppapi/ppapi_test.cc ('k') | content/browser/media/media_browsertest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698