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

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

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