Chromium Code Reviews| 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 // Only the tabs are interesting. | 250 // Only the tabs are interesting. |
| 251 const base::ListValue* tabs = NULL; | 251 const base::ListValue* tabs = NULL; |
| 252 EXPECT_TRUE(window->GetList("tabs", &tabs)); | 252 EXPECT_TRUE(window->GetList("tabs", &tabs)); |
| 253 EXPECT_EQ(arraysize(kTabIDs), tabs->GetSize()); | 253 EXPECT_EQ(arraysize(kTabIDs), tabs->GetSize()); |
| 254 for (size_t j = 0; j < tabs->GetSize(); ++j) { | 254 for (size_t j = 0; j < tabs->GetSize(); ++j) { |
| 255 const base::DictionaryValue* tab = NULL; | 255 const base::DictionaryValue* tab = NULL; |
| 256 EXPECT_TRUE(tabs->GetDictionary(j, &tab)); | 256 EXPECT_TRUE(tabs->GetDictionary(j, &tab)); |
| 257 EXPECT_FALSE(tab->HasKey("id")); // sessions API does not give tab IDs | 257 EXPECT_FALSE(tab->HasKey("id")); // sessions API does not give tab IDs |
| 258 EXPECT_EQ(static_cast<int>(j), utils::GetInteger(tab, "index")); | 258 EXPECT_EQ(static_cast<int>(j), utils::GetInteger(tab, "index")); |
| 259 EXPECT_EQ(0, utils::GetInteger(tab, "windowId")); | 259 EXPECT_EQ(0, utils::GetInteger(tab, "windowId")); |
| 260 EXPECT_EQ(true, utils::GetBoolean(tab, "pinned")); | 260 EXPECT_EQ(j == 0, utils::GetBoolean(tab, "active")); |
|
Nicolas Zea
2014/10/23 22:08:23
nit: comment that the first tab is always the tab
not at google - send to devlin
2014/10/23 22:15:10
Done.
| |
| 261 EXPECT_FALSE(utils::GetBoolean(tab, "selected")); | |
| 262 EXPECT_FALSE(utils::GetBoolean(tab, "highlighted")); | |
| 263 EXPECT_FALSE(utils::GetBoolean(tab, "incognito")); | |
| 264 EXPECT_TRUE(utils::GetBoolean(tab, "pinned")); | |
| 261 EXPECT_EQ("http://foo/1", utils::GetString(tab, "url")); | 265 EXPECT_EQ("http://foo/1", utils::GetString(tab, "url")); |
| 262 EXPECT_EQ("MyTitle", utils::GetString(tab, "title")); | 266 EXPECT_EQ("MyTitle", utils::GetString(tab, "title")); |
| 263 EXPECT_EQ("http://foo/favicon.ico", utils::GetString(tab, "favIconUrl")); | 267 EXPECT_EQ("http://foo/favicon.ico", utils::GetString(tab, "favIconUrl")); |
| 264 EXPECT_EQ(base::StringPrintf("%s.%d", kSessionTags[i], kTabIDs[j]), | 268 EXPECT_EQ(base::StringPrintf("%s.%d", kSessionTags[i], kTabIDs[j]), |
| 265 utils::GetString(tab, "sessionId")); | 269 utils::GetString(tab, "sessionId")); |
| 266 } | 270 } |
| 267 } | 271 } |
| 268 return testing::AssertionSuccess(); | 272 return testing::AssertionSuccess(); |
| 269 } | 273 } |
| 270 | 274 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 380 return; | 384 return; |
| 381 #endif | 385 #endif |
| 382 | 386 |
| 383 ASSERT_TRUE(RunExtensionSubtest("sessions", | 387 ASSERT_TRUE(RunExtensionSubtest("sessions", |
| 384 "sessions.html")) << message_; | 388 "sessions.html")) << message_; |
| 385 } | 389 } |
| 386 | 390 |
| 387 } // namespace | 391 } // namespace |
| 388 | 392 |
| 389 } // namespace extensions | 393 } // namespace extensions |
| OLD | NEW |