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

Unified Diff: ios/shared/chrome/browser/tabs/web_state_opener_unittest.mm

Issue 2799723002: [ios] Move WebStateList to ios/chrome/browser/web_state_list. (Closed)
Patch Set: Rebase. Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: ios/shared/chrome/browser/tabs/web_state_opener_unittest.mm
diff --git a/ios/shared/chrome/browser/tabs/web_state_opener_unittest.mm b/ios/shared/chrome/browser/tabs/web_state_opener_unittest.mm
deleted file mode 100644
index 1e5a0939182df3323c545752f09725296292f1bc..0000000000000000000000000000000000000000
--- a/ios/shared/chrome/browser/tabs/web_state_opener_unittest.mm
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#import "ios/shared/chrome/browser/tabs/web_state_opener.h"
-
-#include <memory>
-
-#include "base/memory/ptr_util.h"
-#import "ios/web/public/test/fakes/test_navigation_manager.h"
-#import "ios/web/public/test/fakes/test_web_state.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "testing/platform_test.h"
-
-#if !defined(__has_feature) || !__has_feature(objc_arc)
-#error "This file requires ARC support."
-#endif
-
-namespace {
-
-class FakeNavigationManager : public web::TestNavigationManager {
- public:
- explicit FakeNavigationManager(int last_committed_item_index)
- : last_committed_item_index_(last_committed_item_index) {}
-
- // web::NavigationManager implementation.
- int GetLastCommittedItemIndex() const override {
- return last_committed_item_index_;
- }
-
- private:
- int last_committed_item_index_;
-
- DISALLOW_COPY_AND_ASSIGN(FakeNavigationManager);
-};
-
-} // namespace
-
-class WebStateOpenerTest : public PlatformTest {
- public:
- WebStateOpenerTest() = default;
-
- std::unique_ptr<web::WebState> CreateWebState(int last_committed_item_index) {
- auto test_web_state = base::MakeUnique<web::TestWebState>();
- test_web_state->SetNavigationManager(
- base::MakeUnique<FakeNavigationManager>(last_committed_item_index));
- // TODO(crbug.com/703565): remove std::move() once Xcode 9.0+ is required.
- return std::move(test_web_state);
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(WebStateOpenerTest);
-};
-
-TEST_F(WebStateOpenerTest, NullWebState) {
- WebStateOpener opener(nullptr);
-
- EXPECT_EQ(nullptr, opener.opener);
- EXPECT_EQ(-1, opener.navigation_index);
-}
-
-TEST_F(WebStateOpenerTest, DefaultNavigationIndex) {
- std::unique_ptr<web::WebState> web_state = CreateWebState(2);
- WebStateOpener opener(web_state.get());
-
- EXPECT_EQ(web_state.get(), opener.opener);
- EXPECT_EQ(2, opener.navigation_index);
-}
-
-TEST_F(WebStateOpenerTest, ExplicitNavigationIndex) {
- std::unique_ptr<web::WebState> web_state = CreateWebState(2);
- WebStateOpener opener(web_state.get(), 1);
-
- EXPECT_EQ(web_state.get(), opener.opener);
- EXPECT_EQ(1, opener.navigation_index);
-}
« no previous file with comments | « ios/shared/chrome/browser/tabs/web_state_opener.mm ('k') | ios/shared/chrome/browser/ui/browser_list/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698