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

Side by Side Diff: chrome/browser/extensions/api/screenlock_private/screenlock_private_apitest.cc

Issue 2832153003: Move calling of shared browser test methods like SetUpOnMainThread/TearDownOnMainThread/RunTestOn... (Closed)
Patch Set: sync Created 3 years, 8 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
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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 void SetUpOnMainThread() override { 52 void SetUpOnMainThread() override {
53 SigninManagerFactory::GetForProfile(profile()) 53 SigninManagerFactory::GetForProfile(profile())
54 ->SetAuthenticatedAccountInfo(kTestGaiaId, kTestUser); 54 ->SetAuthenticatedAccountInfo(kTestGaiaId, kTestUser);
55 ProfileAttributesEntry* entry; 55 ProfileAttributesEntry* entry;
56 ASSERT_TRUE(g_browser_process->profile_manager()-> 56 ASSERT_TRUE(g_browser_process->profile_manager()->
57 GetProfileAttributesStorage(). 57 GetProfileAttributesStorage().
58 GetProfileAttributesWithPath(profile()->GetPath(), &entry)); 58 GetProfileAttributesWithPath(profile()->GetPath(), &entry));
59 entry->SetAuthInfo( 59 entry->SetAuthInfo(
60 kTestGaiaId, base::UTF8ToUTF16(test_account_id_.GetUserEmail())); 60 kTestGaiaId, base::UTF8ToUTF16(test_account_id_.GetUserEmail()));
61 registrar_.Add(this,
62 extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE,
63 content::NotificationService::AllSources());
61 ExtensionApiTest::SetUpOnMainThread(); 64 ExtensionApiTest::SetUpOnMainThread();
62 } 65 }
63 66
64 protected: 67 void TearDownOnMainThread() override {
65 // ExtensionApiTest override: 68 ExtensionApiTest::TearDownOnMainThread();
66 void RunTestOnMainThreadLoop() override {
67 registrar_.Add(this,
68 extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE,
69 content::NotificationService::AllSources());
70 ExtensionApiTest::RunTestOnMainThreadLoop();
71 registrar_.RemoveAll(); 69 registrar_.RemoveAll();
72 } 70 }
73 71
72 protected:
74 // content::NotificationObserver override: 73 // content::NotificationObserver override:
75 void Observe(int type, 74 void Observe(int type,
76 const content::NotificationSource& source, 75 const content::NotificationSource& source,
77 const content::NotificationDetails& details) override { 76 const content::NotificationDetails& details) override {
78 const std::string& message = 77 const std::string& message =
79 content::Details<std::pair<std::string, bool*>>(details).ptr()->first; 78 content::Details<std::pair<std::string, bool*>>(details).ptr()->first;
80 if (message == kAttemptClickAuthMessage) { 79 if (message == kAttemptClickAuthMessage) {
81 proximity_auth::ScreenlockBridge::Get()->lock_handler()->SetAuthType( 80 proximity_auth::ScreenlockBridge::Get()->lock_handler()->SetAuthType(
82 test_account_id_, 81 test_account_id_,
83 proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, 82 proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK,
(...skipping 29 matching lines...) Expand all
113 RunTest("screenlock_private/lock_unlock"); 112 RunTest("screenlock_private/lock_unlock");
114 } 113 }
115 114
116 IN_PROC_BROWSER_TEST_F(ScreenlockPrivateApiTest, AuthType) { 115 IN_PROC_BROWSER_TEST_F(ScreenlockPrivateApiTest, AuthType) {
117 RunTest("screenlock_private/auth_type"); 116 RunTest("screenlock_private/auth_type");
118 } 117 }
119 118
120 #endif // defined(OS_CHROMEOS) 119 #endif // defined(OS_CHROMEOS)
121 120
122 } // namespace extensions 121 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698