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

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

Issue 673933002: Correctly set tab.active not tab.selected in the chrome.sessions API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 6 years, 2 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
« no previous file with comments | « chrome/browser/extensions/api/sessions/sessions_api.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Test setup code always sets tab 0 to selected (which means active in
261 // extension terminology).
262 EXPECT_EQ(j == 0, utils::GetBoolean(tab, "active"));
263 // While selected/highlighted are different to active, and should always
264 // be false.
265 EXPECT_FALSE(utils::GetBoolean(tab, "selected"));
266 EXPECT_FALSE(utils::GetBoolean(tab, "highlighted"));
267 EXPECT_FALSE(utils::GetBoolean(tab, "incognito"));
268 EXPECT_TRUE(utils::GetBoolean(tab, "pinned"));
261 EXPECT_EQ("http://foo/1", utils::GetString(tab, "url")); 269 EXPECT_EQ("http://foo/1", utils::GetString(tab, "url"));
262 EXPECT_EQ("MyTitle", utils::GetString(tab, "title")); 270 EXPECT_EQ("MyTitle", utils::GetString(tab, "title"));
263 EXPECT_EQ("http://foo/favicon.ico", utils::GetString(tab, "favIconUrl")); 271 EXPECT_EQ("http://foo/favicon.ico", utils::GetString(tab, "favIconUrl"));
264 EXPECT_EQ(base::StringPrintf("%s.%d", kSessionTags[i], kTabIDs[j]), 272 EXPECT_EQ(base::StringPrintf("%s.%d", kSessionTags[i], kTabIDs[j]),
265 utils::GetString(tab, "sessionId")); 273 utils::GetString(tab, "sessionId"));
266 } 274 }
267 } 275 }
268 return testing::AssertionSuccess(); 276 return testing::AssertionSuccess();
269 } 277 }
270 278
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 return; 388 return;
381 #endif 389 #endif
382 390
383 ASSERT_TRUE(RunExtensionSubtest("sessions", 391 ASSERT_TRUE(RunExtensionSubtest("sessions",
384 "sessions.html")) << message_; 392 "sessions.html")) << message_;
385 } 393 }
386 394
387 } // namespace 395 } // namespace
388 396
389 } // namespace extensions 397 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/sessions/sessions_api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698