| 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/pattern.h" | 9 #include "base/strings/pattern.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 EXPECT_TRUE(sessions->GetDictionary(0, &session)); | 246 EXPECT_TRUE(sessions->GetDictionary(0, &session)); |
| 247 const base::DictionaryValue* window = NULL; | 247 const base::DictionaryValue* window = NULL; |
| 248 EXPECT_TRUE(session->GetDictionary("window", &window)); | 248 EXPECT_TRUE(session->GetDictionary("window", &window)); |
| 249 // Only the tabs are interesting. | 249 // Only the tabs are interesting. |
| 250 const base::ListValue* tabs = NULL; | 250 const base::ListValue* tabs = NULL; |
| 251 EXPECT_TRUE(window->GetList("tabs", &tabs)); | 251 EXPECT_TRUE(window->GetList("tabs", &tabs)); |
| 252 EXPECT_EQ(arraysize(kTabIDs), tabs->GetSize()); | 252 EXPECT_EQ(arraysize(kTabIDs), tabs->GetSize()); |
| 253 for (size_t j = 0; j < tabs->GetSize(); ++j) { | 253 for (size_t j = 0; j < tabs->GetSize(); ++j) { |
| 254 const base::DictionaryValue* tab = NULL; | 254 const base::DictionaryValue* tab = NULL; |
| 255 EXPECT_TRUE(tabs->GetDictionary(j, &tab)); | 255 EXPECT_TRUE(tabs->GetDictionary(j, &tab)); |
| 256 EXPECT_FALSE(tab->HasKey("id")); // sessions API does not give tab IDs | 256 EXPECT_EQ(api_test_utils::GetInteger(tab, "id"), |
| 257 -1); // sessions API does not give tab IDs |
| 257 EXPECT_EQ(static_cast<int>(j), api_test_utils::GetInteger(tab, "index")); | 258 EXPECT_EQ(static_cast<int>(j), api_test_utils::GetInteger(tab, "index")); |
| 258 EXPECT_EQ(0, api_test_utils::GetInteger(tab, "windowId")); | 259 EXPECT_EQ(0, api_test_utils::GetInteger(tab, "windowId")); |
| 259 // Test setup code always sets tab 0 to selected (which means active in | 260 // Test setup code always sets tab 0 to selected (which means active in |
| 260 // extension terminology). | 261 // extension terminology). |
| 261 EXPECT_EQ(j == 0, api_test_utils::GetBoolean(tab, "active")); | 262 EXPECT_EQ(j == 0, api_test_utils::GetBoolean(tab, "active")); |
| 262 // While selected/highlighted are different to active, and should always | 263 // While selected/highlighted are different to active, and should always |
| 263 // be false. | 264 // be false. |
| 264 EXPECT_FALSE(api_test_utils::GetBoolean(tab, "selected")); | 265 EXPECT_FALSE(api_test_utils::GetBoolean(tab, "selected")); |
| 265 EXPECT_FALSE(api_test_utils::GetBoolean(tab, "highlighted")); | 266 EXPECT_FALSE(api_test_utils::GetBoolean(tab, "highlighted")); |
| 266 EXPECT_FALSE(api_test_utils::GetBoolean(tab, "incognito")); | 267 EXPECT_FALSE(api_test_utils::GetBoolean(tab, "incognito")); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 return; | 385 return; |
| 385 #endif | 386 #endif |
| 386 | 387 |
| 387 ASSERT_TRUE(RunExtensionSubtest("sessions", | 388 ASSERT_TRUE(RunExtensionSubtest("sessions", |
| 388 "sessions.html")) << message_; | 389 "sessions.html")) << message_; |
| 389 } | 390 } |
| 390 | 391 |
| 391 } // namespace | 392 } // namespace |
| 392 | 393 |
| 393 } // namespace extensions | 394 } // namespace extensions |
| OLD | NEW |