Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Side by Side Diff: chrome/browser/sessions/persistent_tab_restore_service_browsertest.cc

Issue 12212048: Linux/ChromeOS Chromium style checker cleanup, chrome/browser edition. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/browser/sessions/persistent_tab_restore_service.h" 5 #include "chrome/browser/sessions/persistent_tab_restore_service.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/sessions/session_service.h" 10 #include "chrome/browser/sessions/session_service.h"
(...skipping 28 matching lines...) Expand all
39 using content::NavigationEntry; 39 using content::NavigationEntry;
40 40
41 // Create subclass that overrides TimeNow so that we can control the time used 41 // Create subclass that overrides TimeNow so that we can control the time used
42 // for closed tabs and windows. 42 // for closed tabs and windows.
43 class PersistentTabRestoreTimeFactory : public TabRestoreService::TimeFactory { 43 class PersistentTabRestoreTimeFactory : public TabRestoreService::TimeFactory {
44 public: 44 public:
45 PersistentTabRestoreTimeFactory() : time_(base::Time::Now()) {} 45 PersistentTabRestoreTimeFactory() : time_(base::Time::Now()) {}
46 46
47 virtual ~PersistentTabRestoreTimeFactory() {} 47 virtual ~PersistentTabRestoreTimeFactory() {}
48 48
49 virtual base::Time TimeNow() { 49 virtual base::Time TimeNow() OVERRIDE {
50 return time_; 50 return time_;
51 } 51 }
52 52
53 private: 53 private:
54 base::Time time_; 54 base::Time time_;
55 }; 55 };
56 56
57 class PersistentTabRestoreServiceTest : public ChromeRenderViewHostTestHarness { 57 class PersistentTabRestoreServiceTest : public ChromeRenderViewHostTestHarness {
58 public: 58 public:
59 PersistentTabRestoreServiceTest() 59 PersistentTabRestoreServiceTest()
60 : ui_thread_(content::BrowserThread::UI, &message_loop_) { 60 : ui_thread_(content::BrowserThread::UI, &message_loop_) {
61 url1_ = GURL("http://1"); 61 url1_ = GURL("http://1");
62 url2_ = GURL("http://2"); 62 url2_ = GURL("http://2");
63 url3_ = GURL("http://3"); 63 url3_ = GURL("http://3");
64 user_agent_override_ = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.19" 64 user_agent_override_ = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.19"
65 " (KHTML, like Gecko) Chrome/18.0.1025.45 Safari/535.19"; 65 " (KHTML, like Gecko) Chrome/18.0.1025.45 Safari/535.19";
66 } 66 }
67 67
68 ~PersistentTabRestoreServiceTest() { 68 virtual ~PersistentTabRestoreServiceTest() {
69 } 69 }
70 70
71 protected: 71 protected:
72 enum { 72 enum {
73 kMaxEntries = TabRestoreServiceHelper::kMaxEntries, 73 kMaxEntries = TabRestoreServiceHelper::kMaxEntries,
74 }; 74 };
75 75
76 // testing::Test: 76 // testing::Test:
77 virtual void SetUp() OVERRIDE { 77 virtual void SetUp() OVERRIDE {
78 WebKit::initialize(webkit_platform_support_.Get()); 78 WebKit::initialize(webkit_platform_support_.Get());
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 for (size_t i = 0; i < max_entries + 5; i++) { 685 for (size_t i = 0; i < max_entries + 5; i++) {
686 NavigateAndCommit(GURL(StringPrintf("http://%d", static_cast<int>(i)))); 686 NavigateAndCommit(GURL(StringPrintf("http://%d", static_cast<int>(i))));
687 service_->CreateHistoricalTab(web_contents(), -1); 687 service_->CreateHistoricalTab(web_contents(), -1);
688 } 688 }
689 689
690 EXPECT_EQ(max_entries, service_->entries().size()); 690 EXPECT_EQ(max_entries, service_->entries().size());
691 // This should not crash. 691 // This should not crash.
692 service_->LoadTabsFromLastSession(); 692 service_->LoadTabsFromLastSession();
693 EXPECT_EQ(max_entries, service_->entries().size()); 693 EXPECT_EQ(max_entries, service_->entries().size());
694 } 694 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698