Rename GetIconID to GetIconId
[chromium-blink-merge.git] / chrome / browser / extensions / signin / gaia_auth_extension_loader_browsertest.cc
blobd5ecff697ba387e9480df3aad7b73bd43f8be7d6
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/extensions/signin/gaia_auth_extension_loader.h"
6 #include "chrome/browser/profiles/profile.h"
7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/test/base/in_process_browser_test.h"
10 namespace extensions {
12 namespace {
14 const char kTestData1[] = "A test string";
15 const char kTestData2[] = "Another test string";
17 } // namespace
19 typedef InProcessBrowserTest GaiaAuthExtensionLoaderTest;
21 IN_PROC_BROWSER_TEST_F(GaiaAuthExtensionLoaderTest, AddAndGet) {
23 GaiaAuthExtensionLoader* loader = GaiaAuthExtensionLoader::Get(
24 browser()->profile());
25 loader->LoadIfNeeded();
27 int id1 = loader->AddData(kTestData1);
28 int id2 = loader->AddData(kTestData2);
29 EXPECT_NE(id1, id2);
31 std::string fetched;
32 EXPECT_TRUE(loader->GetData(id1, &fetched));
33 EXPECT_EQ(kTestData1, fetched);
35 EXPECT_TRUE(loader->GetData(id2, &fetched));
36 EXPECT_EQ(kTestData2, fetched);
38 const int kUnknownId = 1234;
39 EXPECT_FALSE(loader->GetData(kUnknownId, &fetched));
41 loader->UnloadIfNeeded();
44 IN_PROC_BROWSER_TEST_F(GaiaAuthExtensionLoaderTest, ClearDataOnUnload) {
45 GaiaAuthExtensionLoader* loader = GaiaAuthExtensionLoader::Get(
46 browser()->profile());
47 loader->LoadIfNeeded();
49 int id = loader->AddData(kTestData1);
50 std::string fetched;
51 EXPECT_TRUE(loader->GetData(id, &fetched));
53 loader->UnloadIfNeeded();
54 EXPECT_FALSE(loader->GetData(id, &fetched));
57 } // namespace extensions