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

Side by Side Diff: chrome/browser/user_data_dir_extractor_win_browsertest.cc

Issue 12662033: Show user data dialog earlier on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix chromium style warning: inline virtual method with non-empty bodies. Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/user_data_dir_extractor_win.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 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.
4
5 #include "chrome/test/ui/ui_test.h"
6
7 #include "base/command_line.h"
8 #include "base/file_util.h"
9 #include "base/path_service.h"
10 #include "base/process_util.h"
11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_commands.h"
14 #include "chrome/browser/user_data_dir_extractor_win.h"
15 #include "chrome/common/chrome_notification_types.h"
16 #include "chrome/common/chrome_paths.h"
17 #include "chrome/common/chrome_switches.h"
18 #include "chrome/test/base/in_process_browser_test.h"
19 #include "chrome/test/base/ui_test_utils.h"
20
21 // These tests only apply to the Windows version; see chrome_browser_main.cc:
22 // function GetUserDataDir() for details.
23 class ChromeMainUserDataDirTest : public InProcessBrowserTest {
24 public:
25 ChromeMainUserDataDirTest()
26 : did_get_user_data_dir_(false),
27 did_create_local_state_before_get_user_data_dir_(false) {}
28
29 bool did_get_user_data_dir() const { return did_get_user_data_dir_; }
30 bool did_create_local_state_before_get_user_data_dir() const {
31 return did_create_local_state_before_get_user_data_dir_;
32 }
33
34 protected:
35 virtual void SetUp() OVERRIDE {
36 // Install custom GetUserDataDir callback.
37 callback_ = base::Bind(&ChromeMainUserDataDirTest::GetUserDataDirCallback,
38 this);
39 chrome::InstallCustomGetUserDataDirCallbackForTest(&callback_);
40
41 InProcessBrowserTest::SetUp();
42 }
43
44 private:
45 base::FilePath GetUserDataDirCallback() {
46 did_get_user_data_dir_ = true;
47 did_create_local_state_before_get_user_data_dir_ =
48 g_browser_process && g_browser_process->created_local_state();
49
50 base::FilePath user_data_dir;
51 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
52 return user_data_dir;
53 }
54
55 chrome::GetUserDataDirCallback callback_;
56 bool did_get_user_data_dir_;
57 bool did_create_local_state_before_get_user_data_dir_;
58
59 DISALLOW_COPY_AND_ASSIGN(ChromeMainUserDataDirTest);
60 };
61
62 IN_PROC_BROWSER_TEST_F(ChromeMainUserDataDirTest, GetUserDataDir) {
63 // Verify that GetUserDataDir() has been invoked.
64 ASSERT_TRUE(did_get_user_data_dir());
65
66 // Verify that local state was not created before invoking GetUserDataDir().
67 ASSERT_FALSE(did_create_local_state_before_get_user_data_dir());
68
69 // Verify that we have a valid browser process.
70 ASSERT_TRUE(g_browser_process);
71
72 // Verify that local state is created now.
73 ASSERT_TRUE(g_browser_process->created_local_state());
74 }
OLDNEW
« no previous file with comments | « chrome/browser/user_data_dir_extractor_win.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698