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

Side by Side Diff: webkit/tools/test_shell/test_webview_delegate.cc

Issue 171097: The 2 layout test regressions happened due to changes in the test shell.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // This file contains the implementation of TestWebViewDelegate, which serves 5 // This file contains the implementation of TestWebViewDelegate, which serves
6 // as the WebViewDelegate for the TestShellWebHost. The host is expected to 6 // as the WebViewDelegate for the TestShellWebHost. The host is expected to
7 // have initialized a MessageLoop before these methods are called. 7 // have initialized a MessageLoop before these methods are called.
8 8
9 #include "config.h" 9 #include "config.h"
10 10
11 #undef LOG 11 #undef LOG
12 12
13 #include "webkit/tools/test_shell/test_webview_delegate.h" 13 #include "webkit/tools/test_shell/test_webview_delegate.h"
14 14
15 #include "base/file_util.h" 15 #include "base/file_util.h"
16 #include "base/gfx/point.h" 16 #include "base/gfx/point.h"
17 #include "base/gfx/native_widget_types.h" 17 #include "base/gfx/native_widget_types.h"
18 #include "base/message_loop.h" 18 #include "base/message_loop.h"
19 #include "base/process_util.h" 19 #include "base/process_util.h"
20 #include "base/string_util.h" 20 #include "base/string_util.h"
21 #include "base/trace_event.h" 21 #include "base/trace_event.h"
22 #include "net/base/net_errors.h" 22 #include "net/base/net_errors.h"
23 #include "webkit/api/public/WebData.h" 23 #include "webkit/api/public/WebData.h"
24 #include "webkit/api/public/WebDataSource.h" 24 #include "webkit/api/public/WebDataSource.h"
25 #include "webkit/api/public/WebDragData.h" 25 #include "webkit/api/public/WebDragData.h"
26 #include "webkit/api/public/WebHistoryItem.h" 26 #include "webkit/api/public/WebHistoryItem.h"
27 #include "webkit/api/public/WebFrame.h" 27 #include "webkit/api/public/WebFrame.h"
28 #include "webkit/api/public/WebKit.h" 28 #include "webkit/api/public/WebKit.h"
29 #include "webkit/api/public/WebScreenInfo.h" 29 #include "webkit/api/public/WebScreenInfo.h"
30 #include "webkit/api/public/WebSettings.h"
31 #include "webkit/api/public/WebString.h" 30 #include "webkit/api/public/WebString.h"
32 #include "webkit/api/public/WebURL.h" 31 #include "webkit/api/public/WebURL.h"
33 #include "webkit/api/public/WebURLError.h" 32 #include "webkit/api/public/WebURLError.h"
34 #include "webkit/api/public/WebURLRequest.h" 33 #include "webkit/api/public/WebURLRequest.h"
35 #include "webkit/api/public/WebURLResponse.h" 34 #include "webkit/api/public/WebURLResponse.h"
36 #include "webkit/glue/glue_serialize.h" 35 #include "webkit/glue/glue_serialize.h"
37 #include "webkit/glue/media/buffered_data_source.h" 36 #include "webkit/glue/media/buffered_data_source.h"
38 #include "webkit/glue/media/media_resource_loader_bridge_factory.h" 37 #include "webkit/glue/media/media_resource_loader_bridge_factory.h"
39 #include "webkit/glue/media/simple_data_source.h" 38 #include "webkit/glue/media/simple_data_source.h"
40 #include "webkit/glue/webappcachecontext.h" 39 #include "webkit/glue/webappcachecontext.h"
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 return current_index; 798 return current_index;
800 } 799 }
801 800
802 int TestWebViewDelegate::GetHistoryForwardListCount() { 801 int TestWebViewDelegate::GetHistoryForwardListCount() {
803 int current_index = 802 int current_index =
804 shell_->navigation_controller()->GetLastCommittedEntryIndex(); 803 shell_->navigation_controller()->GetLastCommittedEntryIndex();
805 return shell_->navigation_controller()->GetEntryCount() - current_index - 1; 804 return shell_->navigation_controller()->GetEntryCount() - current_index - 1;
806 } 805 }
807 806
808 void TestWebViewDelegate::SetUserStyleSheetEnabled(bool is_enabled) { 807 void TestWebViewDelegate::SetUserStyleSheetEnabled(bool is_enabled) {
809 // Disabling/enabling this is really just setting it to an empty URL or 808 WebPreferences* prefs = shell_->GetWebPreferences();
810 // setting it to something else. From this location in the code, there's 809 prefs->user_style_sheet_enabled = is_enabled;
811 // no way to know what it's supposed to be. Luckily, right now, this is only 810 prefs->Apply(shell_->webView());
812 // used to disable the user style sheet.
813 DCHECK(!is_enabled);
814 shell_->webView()->GetSettings()->setUserStyleSheetLocation(WebURL());
815 } 811 }
816 812
817 void TestWebViewDelegate::SetUserStyleSheetLocation(const GURL& location) { 813 void TestWebViewDelegate::SetUserStyleSheetLocation(const GURL& location) {
818 shell_->webView()->GetSettings()->setUserStyleSheetLocation(location); 814 WebPreferences* prefs = shell_->GetWebPreferences();
815 prefs->user_style_sheet_enabled = true;
816 prefs->user_style_sheet_location = location;
817 prefs->Apply(shell_->webView());
819 } 818 }
820 819
821 // WebWidgetDelegate --------------------------------------------------------- 820 // WebWidgetDelegate ---------------------------------------------------------
822 821
823 void TestWebViewDelegate::didInvalidateRect(const WebRect& rect) { 822 void TestWebViewDelegate::didInvalidateRect(const WebRect& rect) {
824 if (WebWidgetHost* host = GetWidgetHost()) 823 if (WebWidgetHost* host = GetWidgetHost())
825 host->DidInvalidateRect(rect); 824 host->DidInvalidateRect(rect);
826 } 825 }
827 826
828 void TestWebViewDelegate::didScrollRect(int dx, int dy, 827 void TestWebViewDelegate::didScrollRect(int dx, int dy,
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 return L"main frame \"" + name + L"\""; 1024 return L"main frame \"" + name + L"\"";
1026 else 1025 else
1027 return L"main frame"; 1026 return L"main frame";
1028 } else { 1027 } else {
1029 if (name.length()) 1028 if (name.length())
1030 return L"frame \"" + name + L"\""; 1029 return L"frame \"" + name + L"\"";
1031 else 1030 else
1032 return L"frame (anonymous)"; 1031 return L"frame (anonymous)";
1033 } 1032 }
1034 } 1033 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698