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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 CrashRestoreHelper* helper_; | 49 CrashRestoreHelper* helper_; |
50 }; | 50 }; |
51 | 51 |
52 TEST_F(CrashRestoreHelperTest, MoveAsideTest) { | 52 TEST_F(CrashRestoreHelperTest, MoveAsideTest) { |
53 NSString* backupPath = [helper_ sessionBackupPath]; | 53 NSString* backupPath = [helper_ sessionBackupPath]; |
54 NSFileManager* fileManager = [NSFileManager defaultManager]; | 54 NSFileManager* fileManager = [NSFileManager defaultManager]; |
55 [fileManager removeItemAtPath:backupPath error:NULL]; | 55 [fileManager removeItemAtPath:backupPath error:NULL]; |
56 | 56 |
57 NSData* data = [NSData dataWithBytes:"hello" length:5]; | 57 NSData* data = [NSData dataWithBytes:"hello" length:5]; |
58 SessionServiceIOS* sessionService = [SessionServiceIOS sharedService]; | 58 SessionServiceIOS* sessionService = [SessionServiceIOS sharedService]; |
59 NSString* profileStashPath = | 59 NSString* statePath = |
60 base::SysUTF8ToNSString(chrome_browser_state_->GetStatePath().value()); | 60 base::SysUTF8ToNSString(chrome_browser_state_->GetStatePath().value()); |
61 NSString* sessionPath = | 61 NSString* sessionPath = [sessionService sessionPathForDirectory:statePath]; |
62 [sessionService sessionFilePathForDirectory:profileStashPath]; | |
63 [fileManager createFileAtPath:sessionPath contents:data attributes:nil]; | 62 [fileManager createFileAtPath:sessionPath contents:data attributes:nil]; |
64 NSString* otrProfileStashPath = base::SysUTF8ToNSString( | 63 NSString* otrStatePath = base::SysUTF8ToNSString( |
marq (ping after 24h)
2017/04/11 10:46:29
Per crbug.com/3333, we prefer to just use 'incogni
sdefresne
2017/04/11 11:49:41
Done.
| |
65 otr_chrome_browser_state_->GetStatePath().value()); | 64 otr_chrome_browser_state_->GetStatePath().value()); |
66 NSString* otrSessionPath = | 65 NSString* otrSessionPath = |
67 [sessionService sessionFilePathForDirectory:otrProfileStashPath]; | 66 [sessionService sessionPathForDirectory:otrStatePath]; |
68 [fileManager createFileAtPath:otrSessionPath contents:data attributes:nil]; | 67 [fileManager createFileAtPath:otrSessionPath contents:data attributes:nil]; |
69 | 68 |
70 [helper_ moveAsideSessionInformation]; | 69 [helper_ moveAsideSessionInformation]; |
71 | 70 |
72 EXPECT_EQ(NO, [fileManager fileExistsAtPath:sessionPath]); | 71 EXPECT_EQ(NO, [fileManager fileExistsAtPath:sessionPath]); |
73 EXPECT_EQ(NO, [fileManager fileExistsAtPath:otrSessionPath]); | 72 EXPECT_EQ(NO, [fileManager fileExistsAtPath:otrSessionPath]); |
74 EXPECT_EQ(YES, [fileManager fileExistsAtPath:backupPath]); | 73 EXPECT_EQ(YES, [fileManager fileExistsAtPath:backupPath]); |
75 [fileManager removeItemAtPath:backupPath error:NULL]; | 74 [fileManager removeItemAtPath:backupPath error:NULL]; |
76 } | 75 } |
77 | 76 |
78 } // namespace | 77 } // namespace |
OLD | NEW |