| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/history/visit_tracker.h" | 5 #include "chrome/browser/history/visit_tracker.h" |
| 6 #include "base/basictypes.h" | 6 #include "base/basictypes.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 using history::VisitTracker; | 9 using history::VisitTracker; |
| 10 | 10 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 VisitTracker tracker; | 70 VisitTracker tracker; |
| 71 RunTest(&tracker, test_simple, arraysize(test_simple)); | 71 RunTest(&tracker, test_simple, arraysize(test_simple)); |
| 72 } | 72 } |
| 73 | 73 |
| 74 // Test that referrer is properly computed when there are different frame | 74 // Test that referrer is properly computed when there are different frame |
| 75 // navigations happening. | 75 // navigations happening. |
| 76 TEST(VisitTracker, Frames) { | 76 TEST(VisitTracker, Frames) { |
| 77 VisitToTest test_frames[] = { | 77 VisitToTest test_frames[] = { |
| 78 // Started here: | 78 // Started here: |
| 79 {1, 1, "http://foo.com/", 1, "", 0}, | 79 {1, 1, "http://foo.com/", 1, "", 0}, |
| 80 // Which had an auto-loaded subframe: | 80 // Which had an auto-loaded subframe: |
| 81 {1, 1, "http://foo.com/ad.html", 2, "http://foo.com/", 1}, | 81 {1, 1, "http://foo.com/ad.html", 2, "http://foo.com/", 1}, |
| 82 // ...and another auto-loaded subframe: | 82 // ...and another auto-loaded subframe: |
| 83 {1, 1, "http://foo.com/ad2.html", 3, "http://foo.com/", 1}, | 83 {1, 1, "http://foo.com/ad2.html", 3, "http://foo.com/", 1}, |
| 84 // ...and the user navigated the first subframe to somwhere else | 84 // ...and the user navigated the first subframe to somwhere else |
| 85 {1, 2, "http://bar.com/", 4, "http://foo.com/ad.html", 2}, | 85 {1, 2, "http://bar.com/", 4, "http://foo.com/ad.html", 2}, |
| 86 // ...and then the second subframe somewhere else | 86 // ...and then the second subframe somewhere else |
| 87 {1, 3, "http://fud.com/", 5, "http://foo.com/ad2.html",3}, | 87 {1, 3, "http://fud.com/", 5, "http://foo.com/ad2.html", 3}, |
| 88 // ...and then the main frame somewhere else. | 88 // ...and then the main frame somewhere else. |
| 89 {1, 4, "http://www.google.com/", 6, "http://foo.com/", 1}, | 89 {1, 4, "http://www.google.com/", 6, "http://foo.com/", 1}, |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 VisitTracker tracker; | 92 VisitTracker tracker; |
| 93 RunTest(&tracker, test_frames, arraysize(test_frames)); | 93 RunTest(&tracker, test_frames, arraysize(test_frames)); |
| 94 } | 94 } |
| 95 | 95 |
| 96 // Test frame navigation to make sure that the referrer is properly computed | 96 // Test frame navigation to make sure that the referrer is properly computed |
| 97 // when there are multiple processes navigating the same pages. | 97 // when there are multiple processes navigating the same pages. |
| 98 TEST(VisitTracker, MultiProcess) { | 98 TEST(VisitTracker, MultiProcess) { |
| 99 VisitToTest test_processes[] = { | 99 VisitToTest test_processes[] = { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 129 // Say that process has been destroyed. | 129 // Say that process has been destroyed. |
| 130 tracker.NotifyRenderProcessHostDestruction(MakeFakeHost(1)); | 130 tracker.NotifyRenderProcessHostDestruction(MakeFakeHost(1)); |
| 131 | 131 |
| 132 // Simple navigation from a new process with the same ID, it should not find | 132 // Simple navigation from a new process with the same ID, it should not find |
| 133 // a referrer. | 133 // a referrer. |
| 134 VisitToTest part2[] = { | 134 VisitToTest part2[] = { |
| 135 {1, 1, "http://images.google.com/", 2, "http://www.google.com/", 0}, | 135 {1, 1, "http://images.google.com/", 2, "http://www.google.com/", 0}, |
| 136 }; | 136 }; |
| 137 RunTest(&tracker, part2, arraysize(part2)); | 137 RunTest(&tracker, part2, arraysize(part2)); |
| 138 } | 138 } |
| OLD | NEW |