| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <Cocoa/Cocoa.h> | 5 #include <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
| 10 #import "base/mac/sdk_forward_declarations.h" | 10 #import "base/mac/sdk_forward_declarations.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 : event_queue_(), touch_(CGPointMake(0, 0)) { | 75 : event_queue_(), touch_(CGPointMake(0, 0)) { |
| 76 const base::FilePath base_path(FILE_PATH_LITERAL("scroll")); | 76 const base::FilePath base_path(FILE_PATH_LITERAL("scroll")); |
| 77 url1_ = ui_test_utils::GetTestUrl( | 77 url1_ = ui_test_utils::GetTestUrl( |
| 78 base_path, base::FilePath(FILE_PATH_LITERAL("text.html"))); | 78 base_path, base::FilePath(FILE_PATH_LITERAL("text.html"))); |
| 79 url2_ = ui_test_utils::GetTestUrl( | 79 url2_ = ui_test_utils::GetTestUrl( |
| 80 base_path, base::FilePath(FILE_PATH_LITERAL("blank.html"))); | 80 base_path, base::FilePath(FILE_PATH_LITERAL("blank.html"))); |
| 81 url_iframe_ = ui_test_utils::GetTestUrl( | 81 url_iframe_ = ui_test_utils::GetTestUrl( |
| 82 base_path, base::FilePath(FILE_PATH_LITERAL("iframe.html"))); | 82 base_path, base::FilePath(FILE_PATH_LITERAL("iframe.html"))); |
| 83 } | 83 } |
| 84 | 84 |
| 85 virtual void SetUpOnMainThread() override { | 85 void SetUpOnMainThread() override { |
| 86 event_queue_.reset([[NSMutableArray alloc] init]); | 86 event_queue_.reset([[NSMutableArray alloc] init]); |
| 87 touch_ = CGPointMake(0.5, 0.5); | 87 touch_ = CGPointMake(0.5, 0.5); |
| 88 | 88 |
| 89 // Ensure that the navigation stack is not empty. | 89 // Ensure that the navigation stack is not empty. |
| 90 ui_test_utils::NavigateToURL(browser(), url1_); | 90 ui_test_utils::NavigateToURL(browser(), url1_); |
| 91 ASSERT_EQ(url1_, GetWebContents()->GetURL()); | 91 ASSERT_EQ(url1_, GetWebContents()->GetURL()); |
| 92 ui_test_utils::NavigateToURL(browser(), url2_); | 92 ui_test_utils::NavigateToURL(browser(), url2_); |
| 93 ASSERT_EQ(url2_, GetWebContents()->GetURL()); | 93 ASSERT_EQ(url2_, GetWebContents()->GetURL()); |
| 94 } | 94 } |
| 95 | 95 |
| 96 virtual void TearDownOnMainThread() override { | 96 void TearDownOnMainThread() override { event_queue_.reset(); } |
| 97 event_queue_.reset(); | |
| 98 } | |
| 99 | 97 |
| 100 protected: | 98 protected: |
| 101 // Returns the active web contents. | 99 // Returns the active web contents. |
| 102 content::WebContents* GetWebContents() { | 100 content::WebContents* GetWebContents() { |
| 103 return browser()->tab_strip_model()->GetActiveWebContents(); | 101 return browser()->tab_strip_model()->GetActiveWebContents(); |
| 104 } | 102 } |
| 105 | 103 |
| 106 // Returns the value of |query| from Javascript as an int. | 104 // Returns the value of |query| from Javascript as an int. |
| 107 int GetScriptIntValue(const std::string& query) { | 105 int GetScriptIntValue(const std::string& query) { |
| 108 int value = 0; | 106 int value = 0; |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 QueueTouch( | 720 QueueTouch( |
| 723 DEPLOYMENT_TOUCHES_MOVED, NSEventTypeEndGesture, NSMouseEventSubtype, NO); | 721 DEPLOYMENT_TOUCHES_MOVED, NSEventTypeEndGesture, NSMouseEventSubtype, NO); |
| 724 QueueGestureEnd(); | 722 QueueGestureEnd(); |
| 725 QueueTouch( | 723 QueueTouch( |
| 726 DEPLOYMENT_TOUCHES_ENDED, NSEventTypeEndGesture, NSMouseEventSubtype, NO); | 724 DEPLOYMENT_TOUCHES_ENDED, NSEventTypeEndGesture, NSMouseEventSubtype, NO); |
| 727 QueueTrackpadScroll(0, 0, NSEventPhaseEnded, YES); | 725 QueueTrackpadScroll(0, 0, NSEventPhaseEnded, YES); |
| 728 | 726 |
| 729 RunQueuedEvents(); | 727 RunQueuedEvents(); |
| 730 ExpectUrlAndOffset(url1_, 0); | 728 ExpectUrlAndOffset(url1_, 0); |
| 731 } | 729 } |
| OLD | NEW |