| 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 #include "base/memory/scoped_vector.h" | 5 #include "base/memory/scoped_vector.h" |
| 6 #include "chrome/browser/sessions/session_service.h" | 6 #include "chrome/browser/sessions/session_service.h" |
| 7 #include "chrome/browser/sync/profile_sync_service.h" | 7 #include "chrome/browser/sync/profile_sync_service.h" |
| 8 #include "chrome/browser/sync/test/integration/sessions_helper.h" | 8 #include "chrome/browser/sync/test/integration/sessions_helper.h" |
| 9 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" | 9 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" |
| 10 #include "chrome/browser/sync/test/integration/sync_test.h" | 10 #include "chrome/browser/sync/test/integration/sync_test.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 ASSERT_TRUE(GetLocalWindows(0, new_windows.GetMutable())); | 62 ASSERT_TRUE(GetLocalWindows(0, new_windows.GetMutable())); |
| 63 ASSERT_TRUE(WindowsMatch(*old_windows.Get(), *new_windows.Get())); | 63 ASSERT_TRUE(WindowsMatch(*old_windows.Get(), *new_windows.Get())); |
| 64 } | 64 } |
| 65 | 65 |
| 66 IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, TimestampMatchesHistory) { | 66 IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, TimestampMatchesHistory) { |
| 67 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 67 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 68 | 68 |
| 69 ASSERT_TRUE(CheckInitialState(0)); | 69 ASSERT_TRUE(CheckInitialState(0)); |
| 70 | 70 |
| 71 // We want a URL that doesn't 404 and has a non-empty title. | 71 // We want a URL that doesn't 404 and has a non-empty title. |
| 72 // about:version is simple to render, too. | 72 const GURL url("data:text/html,<html><title>Test</title></html>"); |
| 73 const GURL url("about:version"); | |
| 74 | 73 |
| 75 ScopedWindowMap windows; | 74 ScopedWindowMap windows; |
| 76 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, url, windows.GetMutable())); | 75 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, url, windows.GetMutable())); |
| 77 | 76 |
| 78 int found_navigations = 0; | 77 int found_navigations = 0; |
| 79 for (SessionWindowMap::const_iterator it = windows.Get()->begin(); | 78 for (SessionWindowMap::const_iterator it = windows.Get()->begin(); |
| 80 it != windows.Get()->end(); ++it) { | 79 it != windows.Get()->end(); ++it) { |
| 81 for (std::vector<sessions::SessionTab*>::const_iterator it2 = | 80 for (std::vector<sessions::SessionTab*>::const_iterator it2 = |
| 82 it->second->tabs.begin(); it2 != it->second->tabs.end(); ++it2) { | 81 it->second->tabs.begin(); it2 != it->second->tabs.end(); ++it2) { |
| 83 for (std::vector<sessions::SerializedNavigationEntry>::const_iterator | 82 for (std::vector<sessions::SerializedNavigationEntry>::const_iterator |
| (...skipping 12 matching lines...) Expand all Loading... |
| 96 } | 95 } |
| 97 ASSERT_EQ(1, found_navigations); | 96 ASSERT_EQ(1, found_navigations); |
| 98 } | 97 } |
| 99 | 98 |
| 100 IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, ResponseCodeIsPreserved) { | 99 IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, ResponseCodeIsPreserved) { |
| 101 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 100 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 102 | 101 |
| 103 ASSERT_TRUE(CheckInitialState(0)); | 102 ASSERT_TRUE(CheckInitialState(0)); |
| 104 | 103 |
| 105 // We want a URL that doesn't 404 and has a non-empty title. | 104 // We want a URL that doesn't 404 and has a non-empty title. |
| 106 // about:version is simple to render, too. | 105 const GURL url("data:text/html,<html><title>Test</title></html>"); |
| 107 const GURL url("about:version"); | |
| 108 | 106 |
| 109 ScopedWindowMap windows; | 107 ScopedWindowMap windows; |
| 110 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, url, windows.GetMutable())); | 108 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, url, windows.GetMutable())); |
| 111 | 109 |
| 112 int found_navigations = 0; | 110 int found_navigations = 0; |
| 113 for (SessionWindowMap::const_iterator it = windows.Get()->begin(); | 111 for (SessionWindowMap::const_iterator it = windows.Get()->begin(); |
| 114 it != windows.Get()->end(); ++it) { | 112 it != windows.Get()->end(); ++it) { |
| 115 for (std::vector<sessions::SessionTab*>::const_iterator it2 = | 113 for (std::vector<sessions::SessionTab*>::const_iterator it2 = |
| 116 it->second->tabs.begin(); it2 != it->second->tabs.end(); ++it2) { | 114 it->second->tabs.begin(); it2 != it->second->tabs.end(); ++it2) { |
| 117 for (std::vector<sessions::SerializedNavigationEntry>::const_iterator | 115 for (std::vector<sessions::SerializedNavigationEntry>::const_iterator |
| 118 it3 = (*it2)->navigations.begin(); | 116 it3 = (*it2)->navigations.begin(); |
| 119 it3 != (*it2)->navigations.end(); ++it3) { | 117 it3 != (*it2)->navigations.end(); ++it3) { |
| 120 EXPECT_EQ(200, it3->http_status_code()); | 118 EXPECT_EQ(200, it3->http_status_code()); |
| 121 ++found_navigations; | 119 ++found_navigations; |
| 122 } | 120 } |
| 123 } | 121 } |
| 124 } | 122 } |
| 125 ASSERT_EQ(1, found_navigations); | 123 ASSERT_EQ(1, found_navigations); |
| 126 } | 124 } |
| OLD | NEW |