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

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

Issue 360006: Implementation of PlainTextController.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 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
« no previous file with comments | « webkit/tools/test_shell/test_shell.h ('k') | webkit/tools/test_shell/test_shell.gyp » ('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 (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #undef LOG 5 #undef LOG
6 6
7 #include "webkit/tools/test_shell/test_shell.h" 7 #include "webkit/tools/test_shell/test_shell.h"
8 8
9 #include "app/gfx/codec/png_codec.h" 9 #include "app/gfx/codec/png_codec.h"
10 #include "base/base_paths.h" 10 #include "base/base_paths.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 default_edit_wnd_proc_(0), 116 default_edit_wnd_proc_(0),
117 #endif 117 #endif
118 test_params_(NULL), 118 test_params_(NULL),
119 is_modal_(false), 119 is_modal_(false),
120 dump_stats_table_on_exit_(false) { 120 dump_stats_table_on_exit_(false) {
121 accessibility_controller_.reset(new AccessibilityController(this)); 121 accessibility_controller_.reset(new AccessibilityController(this));
122 delegate_.reset(new TestWebViewDelegate(this)); 122 delegate_.reset(new TestWebViewDelegate(this));
123 popup_delegate_.reset(new TestWebViewDelegate(this)); 123 popup_delegate_.reset(new TestWebViewDelegate(this));
124 layout_test_controller_.reset(new LayoutTestController(this)); 124 layout_test_controller_.reset(new LayoutTestController(this));
125 event_sending_controller_.reset(new EventSendingController(this)); 125 event_sending_controller_.reset(new EventSendingController(this));
126 plain_text_controller_.reset(new PlainTextController(this));
126 text_input_controller_.reset(new TextInputController(this)); 127 text_input_controller_.reset(new TextInputController(this));
127 navigation_controller_.reset(new TestNavigationController(this)); 128 navigation_controller_.reset(new TestNavigationController(this));
128 129
129 URLRequestFilter* filter = URLRequestFilter::GetInstance(); 130 URLRequestFilter* filter = URLRequestFilter::GetInstance();
130 filter->AddHostnameHandler("test-shell-resource", "inspector", 131 filter->AddHostnameHandler("test-shell-resource", "inspector",
131 &URLRequestTestShellFileJob::InspectorFactory); 132 &URLRequestTestShellFileJob::InspectorFactory);
132 url_util::AddStandardScheme("test-shell-resource"); 133 url_util::AddStandardScheme("test-shell-resource");
133 } 134 }
134 135
135 TestShell::~TestShell() { 136 TestShell::~TestShell() {
(...skipping 11 matching lines...) Expand all
147 m_webViewHost.reset(); 148 m_webViewHost.reset();
148 149
149 PlatformCleanUp(); 150 PlatformCleanUp();
150 151
151 StatsTable *table = StatsTable::current(); 152 StatsTable *table = StatsTable::current();
152 if (dump_stats_table_on_exit_) { 153 if (dump_stats_table_on_exit_) {
153 // Dump the stats table. 154 // Dump the stats table.
154 printf("<stats>\n"); 155 printf("<stats>\n");
155 if (table != NULL) { 156 if (table != NULL) {
156 int counter_max = table->GetMaxCounters(); 157 int counter_max = table->GetMaxCounters();
157 for (int index=0; index < counter_max; index++) { 158 for (int index = 0; index < counter_max; index++) {
158 std::string name(table->GetRowName(index)); 159 std::string name(table->GetRowName(index));
159 if (name.length() > 0) { 160 if (name.length() > 0) {
160 int value = table->GetRowValue(index); 161 int value = table->GetRowValue(index);
161 printf("%s:\t%d\n", name.c_str(), value); 162 printf("%s:\t%d\n", name.c_str(), value);
162 } 163 }
163 } 164 }
164 } 165 }
165 printf("</stats>\n"); 166 printf("</stats>\n");
166 } 167 }
167 } 168 }
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 delegate_->show(policy); 462 delegate_->show(policy);
462 } 463 }
463 464
464 void TestShell::BindJSObjectsToWindow(WebFrame* frame) { 465 void TestShell::BindJSObjectsToWindow(WebFrame* frame) {
465 // Only bind the test classes if we're running tests. 466 // Only bind the test classes if we're running tests.
466 if (layout_test_mode_) { 467 if (layout_test_mode_) {
467 accessibility_controller_->BindToJavascript( 468 accessibility_controller_->BindToJavascript(
468 frame, L"accessibilityController"); 469 frame, L"accessibilityController");
469 layout_test_controller_->BindToJavascript(frame, L"layoutTestController"); 470 layout_test_controller_->BindToJavascript(frame, L"layoutTestController");
470 event_sending_controller_->BindToJavascript(frame, L"eventSender"); 471 event_sending_controller_->BindToJavascript(frame, L"eventSender");
472 plain_text_controller_->BindToJavascript(frame, L"plainText");
471 text_input_controller_->BindToJavascript(frame, L"textInputController"); 473 text_input_controller_->BindToJavascript(frame, L"textInputController");
472 } 474 }
473 } 475 }
474 476
475 void TestShell::DumpBackForwardEntry(int index, std::wstring* result) { 477 void TestShell::DumpBackForwardEntry(int index, std::wstring* result) {
476 int current_index = navigation_controller_->GetLastCommittedEntryIndex(); 478 int current_index = navigation_controller_->GetLastCommittedEntryIndex();
477 479
478 std::string content_state = 480 std::string content_state =
479 navigation_controller_->GetEntryAtIndex(index)->GetContentState(); 481 navigation_controller_->GetEntryAtIndex(index)->GetContentState();
480 if (content_state.empty()) { 482 if (content_state.empty()) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 if (!entry.GetURL().SchemeIs("javascript")) { 562 if (!entry.GetURL().SchemeIs("javascript")) {
561 delegate_->set_pending_extra_data( 563 delegate_->set_pending_extra_data(
562 new TestShellExtraData(entry.GetPageID())); 564 new TestShellExtraData(entry.GetPageID()));
563 } 565 }
564 566
565 // If we are reloading, then WebKit will use the state of the current page. 567 // If we are reloading, then WebKit will use the state of the current page.
566 // Otherwise, we give it the state to navigate to. 568 // Otherwise, we give it the state to navigate to.
567 if (reload) { 569 if (reload) {
568 frame->reload(); 570 frame->reload();
569 } else if (!entry.GetContentState().empty()) { 571 } else if (!entry.GetContentState().empty()) {
570 DCHECK(entry.GetPageID() != -1); 572 DCHECK_NE(entry.GetPageID(), -1);
571 frame->loadHistoryItem( 573 frame->loadHistoryItem(
572 webkit_glue::HistoryItemFromString(entry.GetContentState())); 574 webkit_glue::HistoryItemFromString(entry.GetContentState()));
573 } else { 575 } else {
574 DCHECK(entry.GetPageID() == -1); 576 DCHECK_EQ(entry.GetPageID(), -1);
575 frame->loadRequest(WebURLRequest(entry.GetURL())); 577 frame->loadRequest(WebURLRequest(entry.GetURL()));
576 } 578 }
577 579
578 // In case LoadRequest failed before DidCreateDataSource was called. 580 // In case LoadRequest failed before DidCreateDataSource was called.
579 delegate_->set_pending_extra_data(NULL); 581 delegate_->set_pending_extra_data(NULL);
580 582
581 // Restore focus to the main frame prior to loading new request. 583 // Restore focus to the main frame prior to loading new request.
582 // This makes sure that we don't have a focused iframe. Otherwise, that 584 // This makes sure that we don't have a focused iframe. Otherwise, that
583 // iframe would keep focus when the SetFocus called immediately after 585 // iframe would keep focus when the SetFocus called immediately after
584 // LoadRequest, thus making some tests fail (see http://b/issue?id=845337 586 // LoadRequest, thus making some tests fail (see http://b/issue?id=845337
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 702
701 void CloseIdleConnections() { 703 void CloseIdleConnections() {
702 // Used in benchmarking, Ignored for test_shell. 704 // Used in benchmarking, Ignored for test_shell.
703 } 705 }
704 706
705 void SetCacheMode(bool enabled) { 707 void SetCacheMode(bool enabled) {
706 // Used in benchmarking, Ignored for test_shell. 708 // Used in benchmarking, Ignored for test_shell.
707 } 709 }
708 710
709 } // namespace webkit_glue 711 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « webkit/tools/test_shell/test_shell.h ('k') | webkit/tools/test_shell/test_shell.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698