| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 ON_CALL(*service, IsSessionsDataTypeControllerRunning()) | 135 ON_CALL(*service, IsSessionsDataTypeControllerRunning()) |
| 136 .WillByDefault(testing::Return(true)); | 136 .WillByDefault(testing::Return(true)); |
| 137 ON_CALL(*service, GetRegisteredDataTypes()) | 137 ON_CALL(*service, GetRegisteredDataTypes()) |
| 138 .WillByDefault(testing::Return(syncer::UserTypes())); | 138 .WillByDefault(testing::Return(syncer::UserTypes())); |
| 139 ON_CALL(*service, GetPreferredDataTypes()).WillByDefault( | 139 ON_CALL(*service, GetPreferredDataTypes()).WillByDefault( |
| 140 testing::Return(preferred_types)); | 140 testing::Return(preferred_types)); |
| 141 EXPECT_CALL(*service, GetAuthError()).WillRepeatedly( | 141 EXPECT_CALL(*service, GetAuthError()).WillRepeatedly( |
| 142 testing::ReturnRef(no_error)); | 142 testing::ReturnRef(no_error)); |
| 143 ON_CALL(*service, GetActiveDataTypes()).WillByDefault( | 143 ON_CALL(*service, GetActiveDataTypes()).WillByDefault( |
| 144 testing::Return(preferred_types)); | 144 testing::Return(preferred_types)); |
| 145 ON_CALL(*service, GetLocalDeviceInfoMock()).WillByDefault( | |
| 146 testing::Return(new browser_sync::DeviceInfo( | |
| 147 std::string(kSessionTags[0]), | |
| 148 "machine name", | |
| 149 "Chromium 10k", | |
| 150 "Chrome 10k", | |
| 151 sync_pb::SyncEnums_DeviceType_TYPE_LINUX))); | |
| 152 ON_CALL(*service, GetLocalSyncCacheGUID()).WillByDefault( | |
| 153 testing::Return(std::string(kSessionTags[0]))); | |
| 154 EXPECT_CALL(*service, AddObserver(testing::_)).Times(testing::AnyNumber()); | 145 EXPECT_CALL(*service, AddObserver(testing::_)).Times(testing::AnyNumber()); |
| 155 EXPECT_CALL(*service, RemoveObserver(testing::_)).Times(testing::AnyNumber()); | 146 EXPECT_CALL(*service, RemoveObserver(testing::_)).Times(testing::AnyNumber()); |
| 156 | 147 |
| 157 service->Initialize(); | 148 service->Initialize(); |
| 158 } | 149 } |
| 159 | 150 |
| 160 void ExtensionSessionsTest::CreateTestExtension() { | 151 void ExtensionSessionsTest::CreateTestExtension() { |
| 161 scoped_ptr<base::DictionaryValue> test_extension_value( | 152 scoped_ptr<base::DictionaryValue> test_extension_value( |
| 162 utils::ParseDictionary( | 153 utils::ParseDictionary( |
| 163 "{\"name\": \"Test\", \"version\": \"1.0\", " | 154 "{\"name\": \"Test\", \"version\": \"1.0\", " |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 333 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
| 343 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 334 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
| 344 return; | 335 return; |
| 345 #endif | 336 #endif |
| 346 | 337 |
| 347 ASSERT_TRUE(RunExtensionSubtest("sessions", | 338 ASSERT_TRUE(RunExtensionSubtest("sessions", |
| 348 "sessions.html")) << message_; | 339 "sessions.html")) << message_; |
| 349 } | 340 } |
| 350 | 341 |
| 351 } // namespace extensions | 342 } // namespace extensions |
| OLD | NEW |