OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebData.h" | 31 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebData.h" |
32 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebHTTPBody.
h" | 32 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebHTTPBody.
h" |
33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" | 33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" |
34 #include "webkit/glue/glue_serialize.h" | 34 #include "webkit/glue/glue_serialize.h" |
35 | 35 |
36 using content::NavigationEntry; | 36 using content::NavigationEntry; |
37 | 37 |
38 class SessionServiceTest : public BrowserWithTestWindowTest, | 38 class SessionServiceTest : public BrowserWithTestWindowTest, |
39 public content::NotificationObserver { | 39 public content::NotificationObserver { |
40 public: | 40 public: |
41 SessionServiceTest() : window_bounds(0, 1, 2, 3), sync_save_count_(0){} | 41 SessionServiceTest() : window_bounds(0, 1, 2, 3), sync_save_count_(0) {} |
42 | 42 |
43 protected: | 43 protected: |
44 virtual void SetUp() { | 44 virtual void SetUp() { |
45 BrowserWithTestWindowTest::SetUp(); | 45 BrowserWithTestWindowTest::SetUp(); |
46 std::string b = base::Int64ToString(base::Time::Now().ToInternalValue()); | 46 std::string b = base::Int64ToString(base::Time::Now().ToInternalValue()); |
47 | 47 |
48 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 48 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
49 path_ = temp_dir_.path().Append(FILE_PATH_LITERAL("SessionTestDirs")); | 49 path_ = temp_dir_.path().Append(FILE_PATH_LITERAL("SessionTestDirs")); |
50 ASSERT_TRUE(file_util::CreateDirectory(path_)); | 50 ASSERT_TRUE(file_util::CreateDirectory(path_)); |
51 path_ = path_.AppendASCII(b); | 51 path_ = path_.AppendASCII(b); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 UpdateNavigation(window_id, tab1_id, *nav1, true); | 145 UpdateNavigation(window_id, tab1_id, *nav1, true); |
146 | 146 |
147 const gfx::Rect window2_bounds(3, 4, 5, 6); | 147 const gfx::Rect window2_bounds(3, 4, 5, 6); |
148 service()->SetWindowType( | 148 service()->SetWindowType( |
149 window2_id, Browser::TYPE_TABBED, SessionService::TYPE_NORMAL); | 149 window2_id, Browser::TYPE_TABBED, SessionService::TYPE_NORMAL); |
150 service()->SetWindowBounds(window2_id, | 150 service()->SetWindowBounds(window2_id, |
151 window2_bounds, | 151 window2_bounds, |
152 ui::SHOW_STATE_MAXIMIZED); | 152 ui::SHOW_STATE_MAXIMIZED); |
153 helper_.PrepareTabInWindow(window2_id, tab2_id, 0, true); | 153 helper_.PrepareTabInWindow(window2_id, tab2_id, 0, true); |
154 UpdateNavigation(window2_id, tab2_id, *nav2, true); | 154 UpdateNavigation(window2_id, tab2_id, *nav2, true); |
155 | |
156 } | 155 } |
157 | 156 |
158 SessionService* service() { return helper_.service(); } | 157 SessionService* service() { return helper_.service(); } |
159 | 158 |
160 SessionBackend* backend() { return helper_.backend(); } | 159 SessionBackend* backend() { return helper_.backend(); } |
161 | 160 |
162 const gfx::Rect window_bounds; | 161 const gfx::Rect window_bounds; |
163 | 162 |
164 SessionID window_id; | 163 SessionID window_id; |
165 | 164 |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 service()->ScheduleCommand( | 965 service()->ScheduleCommand( |
967 service()->CreateSetActiveWindowCommand(window_id)); | 966 service()->CreateSetActiveWindowCommand(window_id)); |
968 service()->ScheduleCommand( | 967 service()->ScheduleCommand( |
969 service()->CreateSetActiveWindowCommand(window2_id)); | 968 service()->CreateSetActiveWindowCommand(window2_id)); |
970 | 969 |
971 ScopedVector<SessionWindow> windows; | 970 ScopedVector<SessionWindow> windows; |
972 SessionID::id_type active_window_id = 0; | 971 SessionID::id_type active_window_id = 0; |
973 ReadWindows(&(windows.get()), &active_window_id); | 972 ReadWindows(&(windows.get()), &active_window_id); |
974 EXPECT_EQ(window2_id.id(), active_window_id); | 973 EXPECT_EQ(window2_id.id(), active_window_id); |
975 } | 974 } |
OLD | NEW |