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

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

Issue 10827168: Fix user agent override restore pipeline (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Nit addressing Created 8 years, 4 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
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 ReadWindows(&(windows.get())); 690 ReadWindows(&(windows.get()));
691 691
692 helper_.AssertSingleWindowWithSingleTab(windows.get(), 1); 692 helper_.AssertSingleWindowWithSingleTab(windows.get(), 1);
693 EXPECT_TRUE(app_id == windows[0]->tabs[0]->extension_app_id); 693 EXPECT_TRUE(app_id == windows[0]->tabs[0]->extension_app_id);
694 } 694 }
695 695
696 // Check that user agent overrides are persisted. 696 // Check that user agent overrides are persisted.
697 TEST_F(SessionServiceTest, PersistUserAgentOverrides) { 697 TEST_F(SessionServiceTest, PersistUserAgentOverrides) {
698 SessionID tab_id; 698 SessionID tab_id;
699 ASSERT_NE(window_id.id(), tab_id.id()); 699 ASSERT_NE(window_id.id(), tab_id.id());
700 std::string user_agent_override("overridden user agent"); 700 std::string user_agent_override = "Mozilla/5.0 (X11; Linux x86_64) "
701 "AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.45 "
702 "Safari/535.19";
701 703
702 TabNavigation nav1(0, GURL("http://google.com"), content::Referrer(), 704 TabNavigation nav1(0, GURL("http://google.com"), content::Referrer(),
703 ASCIIToUTF16("abc"), std::string(), 705 ASCIIToUTF16("abc"), std::string(),
704 content::PAGE_TRANSITION_QUALIFIER_MASK); 706 content::PAGE_TRANSITION_QUALIFIER_MASK);
705 nav1.set_is_overriding_user_agent(true); 707 nav1.set_is_overriding_user_agent(true);
706 708
707 helper_.PrepareTabInWindow(window_id, tab_id, 0, true); 709 helper_.PrepareTabInWindow(window_id, tab_id, 0, true);
708 UpdateNavigation(window_id, tab_id, nav1, 0, true); 710 UpdateNavigation(window_id, tab_id, nav1, 0, true);
709 helper_.SetTabUserAgentOverride(window_id, tab_id, user_agent_override); 711 helper_.SetTabUserAgentOverride(window_id, tab_id, user_agent_override);
710 712
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 ASSERT_TRUE(file_util::CopyFile(v1_file_path, dest_file_path)); 866 ASSERT_TRUE(file_util::CopyFile(v1_file_path, dest_file_path));
865 867
866 SessionService* session_service = new SessionService(path_); 868 SessionService* session_service = new SessionService(path_);
867 helper_.set_service(session_service); 869 helper_.set_service(session_service);
868 ScopedVector<SessionWindow> windows; 870 ScopedVector<SessionWindow> windows;
869 helper_.ReadWindows(&(windows.get())); 871 helper_.ReadWindows(&(windows.get()));
870 ASSERT_EQ(1u, windows.size()); 872 ASSERT_EQ(1u, windows.size());
871 EXPECT_EQ(1u, windows[0]->tabs.size()); 873 EXPECT_EQ(1u, windows[0]->tabs.size());
872 } 874 }
873 #endif 875 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698