OLD | NEW |
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" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 sync_pb::TabNavigation* navigation = tab->add_navigation(); | 78 sync_pb::TabNavigation* navigation = tab->add_navigation(); |
79 navigation->set_virtual_url("http://foo/1"); | 79 navigation->set_virtual_url("http://foo/1"); |
80 navigation->set_favicon_url("http://foo/favicon.ico"); | 80 navigation->set_favicon_url("http://foo/favicon.ico"); |
81 navigation->set_referrer("MyReferrer"); | 81 navigation->set_referrer("MyReferrer"); |
82 navigation->set_title("MyTitle"); | 82 navigation->set_title("MyTitle"); |
83 navigation->set_page_transition(sync_pb::SyncEnums_PageTransition_TYPED); | 83 navigation->set_page_transition(sync_pb::SyncEnums_PageTransition_TYPED); |
84 } | 84 } |
85 | 85 |
86 class ExtensionSessionsTest : public InProcessBrowserTest { | 86 class ExtensionSessionsTest : public InProcessBrowserTest { |
87 public: | 87 public: |
88 void SetUpCommandLine(CommandLine* command_line) override; | 88 void SetUpCommandLine(base::CommandLine* command_line) override; |
89 void SetUpOnMainThread() override; | 89 void SetUpOnMainThread() override; |
90 | 90 |
91 protected: | 91 protected: |
92 static KeyedService* BuildProfileSyncService( | 92 static KeyedService* BuildProfileSyncService( |
93 content::BrowserContext* profile); | 93 content::BrowserContext* profile); |
94 | 94 |
95 void CreateTestProfileSyncService(); | 95 void CreateTestProfileSyncService(); |
96 void CreateTestExtension(); | 96 void CreateTestExtension(); |
97 void CreateSessionModels(); | 97 void CreateSessionModels(); |
98 | 98 |
99 template <class T> | 99 template <class T> |
100 scoped_refptr<T> CreateFunction(bool has_callback) { | 100 scoped_refptr<T> CreateFunction(bool has_callback) { |
101 scoped_refptr<T> fn(new T()); | 101 scoped_refptr<T> fn(new T()); |
102 fn->set_extension(extension_.get()); | 102 fn->set_extension(extension_.get()); |
103 fn->set_has_callback(has_callback); | 103 fn->set_has_callback(has_callback); |
104 return fn; | 104 return fn; |
105 } | 105 } |
106 | 106 |
107 Browser* browser_; | 107 Browser* browser_; |
108 scoped_refptr<Extension> extension_; | 108 scoped_refptr<Extension> extension_; |
109 }; | 109 }; |
110 | 110 |
111 void ExtensionSessionsTest::SetUpCommandLine(CommandLine* command_line) { | 111 void ExtensionSessionsTest::SetUpCommandLine(base::CommandLine* command_line) { |
112 #if defined(OS_CHROMEOS) | 112 #if defined(OS_CHROMEOS) |
113 command_line->AppendSwitch( | 113 command_line->AppendSwitch( |
114 chromeos::switches::kIgnoreUserProfileMappingForTests); | 114 chromeos::switches::kIgnoreUserProfileMappingForTests); |
115 #endif | 115 #endif |
116 } | 116 } |
117 | 117 |
118 void ExtensionSessionsTest::SetUpOnMainThread() { | 118 void ExtensionSessionsTest::SetUpOnMainThread() { |
119 CreateTestProfileSyncService(); | 119 CreateTestProfileSyncService(); |
120 CreateTestExtension(); | 120 CreateTestExtension(); |
121 } | 121 } |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 377 |
378 // Flaky on ChromeOS, times out on OSX Debug http://crbug.com/251199 | 378 // Flaky on ChromeOS, times out on OSX Debug http://crbug.com/251199 |
379 #if defined(OS_CHROMEOS) || (defined(OS_MACOSX) && !defined(NDEBUG)) | 379 #if defined(OS_CHROMEOS) || (defined(OS_MACOSX) && !defined(NDEBUG)) |
380 #define MAYBE_SessionsApis DISABLED_SessionsApis | 380 #define MAYBE_SessionsApis DISABLED_SessionsApis |
381 #else | 381 #else |
382 #define MAYBE_SessionsApis SessionsApis | 382 #define MAYBE_SessionsApis SessionsApis |
383 #endif | 383 #endif |
384 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_SessionsApis) { | 384 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_SessionsApis) { |
385 #if defined(OS_WIN) && defined(USE_ASH) | 385 #if defined(OS_WIN) && defined(USE_ASH) |
386 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 386 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
387 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 387 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 388 switches::kAshBrowserTests)) |
388 return; | 389 return; |
389 #endif | 390 #endif |
390 | 391 |
391 ASSERT_TRUE(RunExtensionSubtest("sessions", | 392 ASSERT_TRUE(RunExtensionSubtest("sessions", |
392 "sessions.html")) << message_; | 393 "sessions.html")) << message_; |
393 } | 394 } |
394 | 395 |
395 } // namespace | 396 } // namespace |
396 | 397 |
397 } // namespace extensions | 398 } // namespace extensions |
OLD | NEW |