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

Side by Side Diff: chrome/browser/extensions/api/sessions/sessions_apitest.cc

Issue 271533004: Turning on MultiProfile by default for ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/extensions/api/sessions/sessions_api.h" 5 #include "chrome/browser/extensions/api/sessions/sessions_api.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "chrome/browser/extensions/api/tabs/tabs_api.h" 10 #include "chrome/browser/extensions/api/tabs/tabs_api.h"
11 #include "chrome/browser/extensions/extension_apitest.h" 11 #include "chrome/browser/extensions/extension_apitest.h"
12 #include "chrome/browser/extensions/extension_function_test_utils.h" 12 #include "chrome/browser/extensions/extension_function_test_utils.h"
13 #include "chrome/browser/profiles/profile_manager.h" 13 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/browser/sync/open_tabs_ui_delegate.h" 14 #include "chrome/browser/sync/open_tabs_ui_delegate.h"
15 #include "chrome/browser/sync/profile_sync_service.h" 15 #include "chrome/browser/sync/profile_sync_service.h"
16 #include "chrome/browser/sync/profile_sync_service_factory.h" 16 #include "chrome/browser/sync/profile_sync_service_factory.h"
17 #include "chrome/browser/sync/profile_sync_service_mock.h" 17 #include "chrome/browser/sync/profile_sync_service_mock.h"
18 #include "chrome/common/chrome_paths.h" 18 #include "chrome/common/chrome_paths.h"
19 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
20 #include "chrome/test/base/in_process_browser_test.h" 20 #include "chrome/test/base/in_process_browser_test.h"
21 #include "chrome/test/base/test_switches.h" 21 #include "chrome/test/base/test_switches.h"
22 #include "chrome/test/base/testing_browser_process.h" 22 #include "chrome/test/base/testing_browser_process.h"
23 #include "sync/api/attachments/attachment_id.h" 23 #include "sync/api/attachments/attachment_id.h"
24 #include "sync/api/attachments/attachment_service_proxy_for_test.h" 24 #include "sync/api/attachments/attachment_service_proxy_for_test.h"
25 #include "sync/api/fake_sync_change_processor.h" 25 #include "sync/api/fake_sync_change_processor.h"
26 #include "sync/api/sync_error_factory_mock.h" 26 #include "sync/api/sync_error_factory_mock.h"
27 27
28 #if defined(OS_CHROMEOS)
29 #include "chromeos/chromeos_switches.h"
30 #endif
31
28 namespace utils = extension_function_test_utils; 32 namespace utils = extension_function_test_utils;
29 33
30 namespace extensions { 34 namespace extensions {
31 35
32 namespace { 36 namespace {
33 37
34 // If more sessions are added to session tags, num sessions should be updated. 38 // If more sessions are added to session tags, num sessions should be updated.
35 const char* kSessionTags[] = {"tag0", "tag1", "tag2", "tag3", "tag4"}; 39 const char* kSessionTags[] = {"tag0", "tag1", "tag2", "tag3", "tag4"};
36 const size_t kNumSessions = 5; 40 const size_t kNumSessions = 5;
37 41
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 navigation->set_virtual_url("http://foo/1"); 75 navigation->set_virtual_url("http://foo/1");
72 navigation->set_referrer("referrer"); 76 navigation->set_referrer("referrer");
73 navigation->set_title("title"); 77 navigation->set_title("title");
74 navigation->set_page_transition(sync_pb::SyncEnums_PageTransition_TYPED); 78 navigation->set_page_transition(sync_pb::SyncEnums_PageTransition_TYPED);
75 } 79 }
76 80
77 } // namespace 81 } // namespace
78 82
79 class ExtensionSessionsTest : public InProcessBrowserTest { 83 class ExtensionSessionsTest : public InProcessBrowserTest {
80 public: 84 public:
85 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE;
81 virtual void SetUpOnMainThread() OVERRIDE; 86 virtual void SetUpOnMainThread() OVERRIDE;
82 protected: 87 protected:
83 void CreateTestProfileSyncService(); 88 void CreateTestProfileSyncService();
84 void CreateTestExtension(); 89 void CreateTestExtension();
85 void CreateSessionModels(); 90 void CreateSessionModels();
86 91
87 template <class T> 92 template <class T>
88 scoped_refptr<T> CreateFunction(bool has_callback) { 93 scoped_refptr<T> CreateFunction(bool has_callback) {
89 scoped_refptr<T> fn(new T()); 94 scoped_refptr<T> fn(new T());
90 fn->set_extension(extension_.get()); 95 fn->set_extension(extension_.get());
91 fn->set_has_callback(has_callback); 96 fn->set_has_callback(has_callback);
92 return fn; 97 return fn;
93 }; 98 };
94 99
95 Browser* browser_; 100 Browser* browser_;
96 scoped_refptr<extensions::Extension> extension_; 101 scoped_refptr<extensions::Extension> extension_;
97 }; 102 };
98 103
104 void ExtensionSessionsTest::SetUpCommandLine(CommandLine* command_line) {
105 #if defined(OS_CHROMEOS)
106 command_line->AppendSwitch(
107 chromeos::switches::kIgnoreUserProfileMappingForTests);
108 #endif
109 }
110
99 void ExtensionSessionsTest::SetUpOnMainThread() { 111 void ExtensionSessionsTest::SetUpOnMainThread() {
100 CreateTestProfileSyncService(); 112 CreateTestProfileSyncService();
101 CreateTestExtension(); 113 CreateTestExtension();
102 } 114 }
103 115
104 void ExtensionSessionsTest::CreateTestProfileSyncService() { 116 void ExtensionSessionsTest::CreateTestProfileSyncService() {
105 ProfileManager* profile_manager = g_browser_process->profile_manager(); 117 ProfileManager* profile_manager = g_browser_process->profile_manager();
106 base::FilePath path; 118 base::FilePath path;
107 PathService::Get(chrome::DIR_USER_DATA, &path); 119 PathService::Get(chrome::DIR_USER_DATA, &path);
108 path = path.AppendASCII("test_profile"); 120 path = path.AppendASCII("test_profile");
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 340 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
329 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) 341 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
330 return; 342 return;
331 #endif 343 #endif
332 344
333 ASSERT_TRUE(RunExtensionSubtest("sessions", 345 ASSERT_TRUE(RunExtensionSubtest("sessions",
334 "sessions.html")) << message_; 346 "sessions.html")) << message_;
335 } 347 }
336 348
337 } // namespace extensions 349 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698