| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/scoped_ptr.h" | 7 #include "base/scoped_ptr.h" |
| 8 #include "base/scoped_vector.h" | 8 #include "base/scoped_vector.h" |
| 9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "base/time.h" | 11 #include "base/time.h" |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 | 575 |
| 576 ScopedVector<SessionWindow> windows; | 576 ScopedVector<SessionWindow> windows; |
| 577 ReadWindows(&(windows.get())); | 577 ReadWindows(&(windows.get())); |
| 578 | 578 |
| 579 helper_.AssertSingleWindowWithSingleTab(windows.get(), 1); | 579 helper_.AssertSingleWindowWithSingleTab(windows.get(), 1); |
| 580 EXPECT_TRUE(app_id == windows[0]->tabs[0]->app_extension_id); | 580 EXPECT_TRUE(app_id == windows[0]->tabs[0]->app_extension_id); |
| 581 } | 581 } |
| 582 | 582 |
| 583 // Explicitly set the pinned state to true and make sure we get back true. | 583 // Explicitly set the pinned state to true and make sure we get back true. |
| 584 TEST_F(SessionServiceTest, PinnedTrue) { | 584 TEST_F(SessionServiceTest, PinnedTrue) { |
| 585 if (!browser_defaults::kEnablePinnedTabs) | |
| 586 return; | |
| 587 | |
| 588 EXPECT_TRUE(CreateAndWriteSessionWithOneTab(true, true)); | 585 EXPECT_TRUE(CreateAndWriteSessionWithOneTab(true, true)); |
| 589 } | 586 } |
| 590 | 587 |
| 591 class GetCurrentSessionCallbackHandler { | 588 class GetCurrentSessionCallbackHandler { |
| 592 public: | 589 public: |
| 593 void OnGotSession(int handle, std::vector<SessionWindow*>* windows) { | 590 void OnGotSession(int handle, std::vector<SessionWindow*>* windows) { |
| 594 EXPECT_EQ(1U, windows->size()); | 591 EXPECT_EQ(1U, windows->size()); |
| 595 EXPECT_EQ(2U, (*windows)[0]->tabs.size()); | 592 EXPECT_EQ(2U, (*windows)[0]->tabs.size()); |
| 596 EXPECT_EQ(2U, (*windows)[0]->tabs[0]->navigations.size()); | 593 EXPECT_EQ(2U, (*windows)[0]->tabs[0]->navigations.size()); |
| 597 EXPECT_EQ(GURL("http://bar/1"), | 594 EXPECT_EQ(GURL("http://bar/1"), |
| (...skipping 12 matching lines...) Expand all Loading... |
| 610 AddTab(browser(), GURL("http://foo/1")); | 607 AddTab(browser(), GURL("http://foo/1")); |
| 611 NavigateAndCommitActiveTab(GURL("http://foo/2")); | 608 NavigateAndCommitActiveTab(GURL("http://foo/2")); |
| 612 AddTab(browser(), GURL("http://bar/1")); | 609 AddTab(browser(), GURL("http://bar/1")); |
| 613 NavigateAndCommitActiveTab(GURL("http://bar/2")); | 610 NavigateAndCommitActiveTab(GURL("http://bar/2")); |
| 614 | 611 |
| 615 CancelableRequestConsumer consumer; | 612 CancelableRequestConsumer consumer; |
| 616 GetCurrentSessionCallbackHandler handler; | 613 GetCurrentSessionCallbackHandler handler; |
| 617 service()->GetCurrentSession(&consumer, | 614 service()->GetCurrentSession(&consumer, |
| 618 NewCallback(&handler, &GetCurrentSessionCallbackHandler::OnGotSession)); | 615 NewCallback(&handler, &GetCurrentSessionCallbackHandler::OnGotSession)); |
| 619 } | 616 } |
| OLD | NEW |