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 #import <Foundation/Foundation.h> | 5 #import <Foundation/Foundation.h> |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
11 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
13 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
14 #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" | 14 #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" |
15 #include "ios/chrome/browser/chrome_paths.h" | 15 #include "ios/chrome/browser/chrome_paths.h" |
16 #import "ios/chrome/browser/sessions/session_service.h" | 16 #import "ios/chrome/browser/sessions/session_service_ios.h" |
17 #import "ios/chrome/browser/sessions/session_window_ios.h" | 17 #import "ios/chrome/browser/sessions/session_window_ios.h" |
18 #include "ios/web/public/navigation_item.h" | 18 #include "ios/web/public/navigation_item.h" |
19 #import "ios/web/public/navigation_manager.h" | 19 #import "ios/web/public/navigation_manager.h" |
20 #include "ios/web/public/test/test_web_thread_bundle.h" | 20 #include "ios/web/public/test/test_web_thread_bundle.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
22 #include "testing/gtest_mac.h" | 22 #include "testing/gtest_mac.h" |
23 #include "testing/platform_test.h" | 23 #include "testing/platform_test.h" |
24 #import "third_party/ocmock/OCMock/OCMock.h" | 24 #import "third_party/ocmock/OCMock/OCMock.h" |
25 | 25 |
26 #if !defined(__has_feature) || !__has_feature(objc_arc) | 26 #if !defined(__has_feature) || !__has_feature(objc_arc) |
(...skipping 29 matching lines...) Expand all Loading... |
56 EXPECT_TRUE(success); | 56 EXPECT_TRUE(success); |
57 if (!success) { | 57 if (!success) { |
58 return nil; | 58 return nil; |
59 } | 59 } |
60 | 60 |
61 plist_path = plist_path.AppendASCII("sessions"); | 61 plist_path = plist_path.AppendASCII("sessions"); |
62 plist_path = plist_path.Append(filename); | 62 plist_path = plist_path.Append(filename); |
63 EXPECT_TRUE(base::PathExists(plist_path)); | 63 EXPECT_TRUE(base::PathExists(plist_path)); |
64 | 64 |
65 NSString* path = base::SysUTF8ToNSString(plist_path.value()); | 65 NSString* path = base::SysUTF8ToNSString(plist_path.value()); |
66 return [service loadWindowFromPath:path | 66 return [service loadWindowFromPath:path]; |
67 forBrowserState:chrome_browser_state_.get()]; | |
68 } | 67 } |
69 | 68 |
70 ios::ChromeBrowserState* chrome_browser_state() { | 69 ios::ChromeBrowserState* chrome_browser_state() { |
71 return chrome_browser_state_.get(); | 70 return chrome_browser_state_.get(); |
72 } | 71 } |
73 | 72 |
74 NSString* directory_name() { return directory_name_; } | 73 NSString* directory_name() { return directory_name_; } |
75 | 74 |
76 private: | 75 private: |
77 base::ScopedTempDir test_dir_; | 76 base::ScopedTempDir test_dir_; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 152 |
154 // TODO(crbug.com/661633): remove this once M68 has shipped (i.e. once more | 153 // TODO(crbug.com/661633): remove this once M68 has shipped (i.e. once more |
155 // than a year has passed since the introduction of the compatibility code). | 154 // than a year has passed since the introduction of the compatibility code). |
156 TEST_F(SessionServiceTest, LoadM58Session) { | 155 TEST_F(SessionServiceTest, LoadM58Session) { |
157 SessionWindowIOS* session_window = | 156 SessionWindowIOS* session_window = |
158 LoadSessionFromTestDataFile(FILE_PATH_LITERAL("session_m58.plist")); | 157 LoadSessionFromTestDataFile(FILE_PATH_LITERAL("session_m58.plist")); |
159 EXPECT_TRUE(session_window != nil); | 158 EXPECT_TRUE(session_window != nil); |
160 } | 159 } |
161 | 160 |
162 } // anonymous namespace | 161 } // anonymous namespace |
OLD | NEW |