| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "base/mac/scoped_nsautorelease_pool.h" | 5 #include "base/mac/scoped_nsautorelease_pool.h" |
| 6 #include "base/memory/ptr_util.h" | 6 #include "base/memory/ptr_util.h" |
| 7 #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" | 7 #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" |
| 8 #include "ios/chrome/browser/browser_state/test_chrome_browser_state_manager.h" | 8 #include "ios/chrome/browser/browser_state/test_chrome_browser_state_manager.h" |
| 9 #import "ios/chrome/browser/sessions/session_window.h" | 9 #import "ios/chrome/browser/sessions/session_window.h" |
| 10 #import "ios/chrome/browser/sessions/test_session_service.h" | 10 #import "ios/chrome/browser/sessions/test_session_service.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 atIndex:TabModelConstants::kTabPositionAutomatically | 79 atIndex:TabModelConstants::kTabPositionAutomatically |
| 80 inBackground:YES]; | 80 inBackground:YES]; |
| 81 } | 81 } |
| 82 | 82 |
| 83 GURL url_; | 83 GURL url_; |
| 84 web::Referrer referrer_; | 84 web::Referrer referrer_; |
| 85 web::TestWebThreadBundle thread_bundle_; | 85 web::TestWebThreadBundle thread_bundle_; |
| 86 IOSChromeScopedTestingChromeBrowserStateManager scoped_browser_state_manager_; | 86 IOSChromeScopedTestingChromeBrowserStateManager scoped_browser_state_manager_; |
| 87 base::scoped_nsobject<SessionWindowIOS> sessionWindow_; | 87 base::scoped_nsobject<SessionWindowIOS> sessionWindow_; |
| 88 std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; | 88 std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; |
| 89 base::mac::ScopedNSAutoreleasePool pool_; |
| 89 base::scoped_nsobject<Tab> dummy_tab_; | 90 base::scoped_nsobject<Tab> dummy_tab_; |
| 90 base::scoped_nsobject<TabModelOrderController> orderController_; | 91 base::scoped_nsobject<TabModelOrderController> orderController_; |
| 91 base::scoped_nsobject<TabModel> tabModel_; | 92 base::scoped_nsobject<TabModel> tabModel_; |
| 92 base::mac::ScopedNSAutoreleasePool pool_; | |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 // Verifies that tabs added in the background (e.g. from context menu -> Open in | 95 // Verifies that tabs added in the background (e.g. from context menu -> Open in |
| 96 // new tab) are inserted in the proper order. | 96 // new tab) are inserted in the proper order. |
| 97 TEST_F(TabModelOrderControllerTest, DetermineInsertionIndexForBackgroundTabs) { | 97 TEST_F(TabModelOrderControllerTest, DetermineInsertionIndexForBackgroundTabs) { |
| 98 // Add |parentTab|, then add |childTab| in the background. | 98 // Add |parentTab|, then add |childTab| in the background. |
| 99 Tab* parentTab = [tabModel_ insertTabWithURL:url_ | 99 Tab* parentTab = [tabModel_ insertTabWithURL:url_ |
| 100 referrer:referrer_ | 100 referrer:referrer_ |
| 101 windowName:nil | 101 windowName:nil |
| 102 opener:nil | 102 opener:nil |
| (...skipping 12 matching lines...) Expand all Loading... |
| 115 // would be inserted before the child's child. | 115 // would be inserted before the child's child. |
| 116 addTabToParentInBackground(childTab); | 116 addTabToParentInBackground(childTab); |
| 117 index = [orderController_ | 117 index = [orderController_ |
| 118 insertionIndexForTab:dummy_tab_ | 118 insertionIndexForTab:dummy_tab_ |
| 119 transition:ui::PAGE_TRANSITION_LINK | 119 transition:ui::PAGE_TRANSITION_LINK |
| 120 opener:parentTab | 120 opener:parentTab |
| 121 adjacency:TabModelOrderConstants::kAdjacentAfter]; | 121 adjacency:TabModelOrderConstants::kAdjacentAfter]; |
| 122 EXPECT_EQ(2, index); | 122 EXPECT_EQ(2, index); |
| 123 } | 123 } |
| 124 } // anonymous namespace | 124 } // anonymous namespace |
| OLD | NEW |