| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #import "ios/shared/chrome/browser/tabs/web_state_list.h" | 5 #import "ios/shared/chrome/browser/tabs/web_state_list.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/supports_user_data.h" | 9 #include "base/supports_user_data.h" |
| 10 #import "ios/shared/chrome/browser/tabs/web_state_list_observer.h" | 10 #import "ios/shared/chrome/browser/tabs/web_state_list_observer.h" |
| 11 #import "ios/web/public/test/fakes/test_navigation_manager.h" | 11 #import "ios/web/public/test/fakes/test_navigation_manager.h" |
| 12 #import "ios/web/public/test/fakes/test_web_state.h" | 12 #import "ios/web/public/test/fakes/test_web_state.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "testing/platform_test.h" | 14 #include "testing/platform_test.h" |
| 15 | 15 |
| 16 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 17 #error "This file requires ARC support." |
| 18 #endif |
| 19 |
| 16 namespace { | 20 namespace { |
| 17 const char kURL0[] = "https://chromium.org/0"; | 21 const char kURL0[] = "https://chromium.org/0"; |
| 18 const char kURL1[] = "https://chromium.org/1"; | 22 const char kURL1[] = "https://chromium.org/1"; |
| 19 const char kURL2[] = "https://chromium.org/2"; | 23 const char kURL2[] = "https://chromium.org/2"; |
| 20 const char kSupportsUserDataDeathGuardKey = '\0'; | 24 const char kSupportsUserDataDeathGuardKey = '\0'; |
| 21 | 25 |
| 22 // A base::SupportsUserData::Data that tracks whether a base::SupportsUserData | 26 // A base::SupportsUserData::Data that tracks whether a base::SupportsUserData |
| 23 // has been deleted (the fact is recorded in a provided pointer as part of the | 27 // has been deleted (the fact is recorded in a provided pointer as part of the |
| 24 // object destruction). | 28 // object destruction). |
| 25 class SupportsUserDataDeathGuard : public base::SupportsUserData::Data { | 29 class SupportsUserDataDeathGuard : public base::SupportsUserData::Data { |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 web_state_list_.GetIndexOfLastWebStateOpenedBy(opener, start_index, | 531 web_state_list_.GetIndexOfLastWebStateOpenedBy(opener, start_index, |
| 528 false)); | 532 false)); |
| 529 | 533 |
| 530 EXPECT_EQ(WebStateList::kInvalidIndex, | 534 EXPECT_EQ(WebStateList::kInvalidIndex, |
| 531 web_state_list_.GetIndexOfNextWebStateOpenedBy(opener, start_index, | 535 web_state_list_.GetIndexOfNextWebStateOpenedBy(opener, start_index, |
| 532 true)); | 536 true)); |
| 533 EXPECT_EQ(WebStateList::kInvalidIndex, | 537 EXPECT_EQ(WebStateList::kInvalidIndex, |
| 534 web_state_list_.GetIndexOfLastWebStateOpenedBy(opener, start_index, | 538 web_state_list_.GetIndexOfLastWebStateOpenedBy(opener, start_index, |
| 535 true)); | 539 true)); |
| 536 } | 540 } |
| OLD | NEW |