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

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

Issue 115575: Move ExtraData from WebRequest to WebDataSource.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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 #include "v8_proxy.h" 5 #include "v8_proxy.h"
6 #undef LOG 6 #undef LOG
7 7
8 #include "webkit/tools/test_shell/test_shell.h" 8 #include "webkit/tools/test_shell/test_shell.h"
9 9
10 #include "base/base_paths.h" 10 #include "base/base_paths.h"
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 cache_policy = WebRequestUseProtocolCachePolicy; 503 cache_policy = WebRequestUseProtocolCachePolicy;
504 } 504 }
505 505
506 scoped_ptr<WebRequest> request(WebRequest::Create(entry.GetURL())); 506 scoped_ptr<WebRequest> request(WebRequest::Create(entry.GetURL()));
507 request->SetCachePolicy(cache_policy); 507 request->SetCachePolicy(cache_policy);
508 // If we are reloading, then WebKit will use the state of the current page. 508 // If we are reloading, then WebKit will use the state of the current page.
509 // Otherwise, we give it the state to navigate to. 509 // Otherwise, we give it the state to navigate to.
510 if (!reload) 510 if (!reload)
511 request->SetHistoryState(entry.GetContentState()); 511 request->SetHistoryState(entry.GetContentState());
512 512
513 request->SetExtraData( 513 // A navigation resulting from loading a javascript URL should not be
514 new TestShellExtraRequestData(entry.GetPageID())); 514 // treated as a browser initiated event. Instead, we want it to look as if
515 // the page initiated any load resulting from JS execution.
516 if (!entry.GetURL().SchemeIs("javascript")) {
517 delegate_->set_pending_extra_data(
518 new TestShellExtraData(entry.GetPageID()));
519 }
515 520
516 // Get the right target frame for the entry. 521 // Get the right target frame for the entry.
517 WebFrame* frame = webView()->GetMainFrame(); 522 WebFrame* frame = webView()->GetMainFrame();
518 if (!entry.GetTargetFrame().empty()) 523 if (!entry.GetTargetFrame().empty())
519 frame = webView()->GetFrameWithName(entry.GetTargetFrame()); 524 frame = webView()->GetFrameWithName(entry.GetTargetFrame());
520 // TODO(mpcomplete): should we clear the target frame, or should 525 // TODO(mpcomplete): should we clear the target frame, or should
521 // back/forward navigations maintain the target frame? 526 // back/forward navigations maintain the target frame?
522 527
523 frame->LoadRequest(request.get()); 528 frame->LoadRequest(request.get());
529
530 // In case LoadRequest failed before DidCreateDataSource was called.
531 delegate_->set_pending_extra_data(NULL);
532
524 // Restore focus to the main frame prior to loading new request. 533 // Restore focus to the main frame prior to loading new request.
525 // This makes sure that we don't have a focused iframe. Otherwise, that 534 // This makes sure that we don't have a focused iframe. Otherwise, that
526 // iframe would keep focus when the SetFocus called immediately after 535 // iframe would keep focus when the SetFocus called immediately after
527 // LoadRequest, thus making some tests fail (see http://b/issue?id=845337 536 // LoadRequest, thus making some tests fail (see http://b/issue?id=845337
528 // for more details). 537 // for more details).
529 webView()->SetFocusedFrame(frame); 538 webView()->SetFocusedFrame(frame);
530 SetFocus(webViewHost(), true); 539 SetFocus(webViewHost(), true);
531 540
532 return true; 541 return true;
533 } 542 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 } 651 }
643 #endif // OS_WIN 652 #endif // OS_WIN
644 return false; 653 return false;
645 } 654 }
646 655
647 std::wstring GetWebKitLocale() { 656 std::wstring GetWebKitLocale() {
648 return L"en-US"; 657 return L"en-US";
649 } 658 }
650 659
651 } // namespace webkit_glue 660 } // namespace webkit_glue
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698