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

Side by Side Diff: chrome/browser/prefs/pref_service_browsertest.cc

Issue 2835233002: Fix integration tests in src/chrome and src/extensions so that we can turn on IO thread checks wi... (Closed)
Patch Set: ready for review 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 (c) 2012 The Chromium Authors. All rights reserved. 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 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 <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/json/json_file_value_serializer.h" 10 #include "base/json/json_file_value_serializer.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/test/test_file_util.h" 12 #include "base/test/test_file_util.h"
13 #include "base/threading/thread_restrictions.h"
13 #include "base/values.h" 14 #include "base/values.h"
14 #include "build/build_config.h" 15 #include "build/build_config.h"
15 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_window.h" 17 #include "chrome/browser/ui/browser_window.h"
17 #include "chrome/browser/ui/browser_window_state.h" 18 #include "chrome/browser/ui/browser_window_state.h"
18 #include "chrome/common/chrome_constants.h" 19 #include "chrome/common/chrome_constants.h"
19 #include "chrome/common/chrome_paths.h" 20 #include "chrome/common/chrome_paths.h"
20 #include "chrome/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
21 #include "chrome/test/base/in_process_browser_test.h" 22 #include "chrome/test/base/in_process_browser_test.h"
22 #include "chrome/test/base/testing_profile.h" 23 #include "chrome/test/base/testing_profile.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // This test verifies that the window position from the prefs file is restored 81 // This test verifies that the window position from the prefs file is restored
81 // when the app restores. This doesn't really make sense on Linux, where 82 // when the app restores. This doesn't really make sense on Linux, where
82 // the window manager might fight with you over positioning. However, we 83 // the window manager might fight with you over positioning. However, we
83 // might be able to make this work on buildbots. 84 // might be able to make this work on buildbots.
84 // TODO(port): revisit this. 85 // TODO(port): revisit this.
85 86
86 IN_PROC_BROWSER_TEST_F(PreferenceServiceTest, Test) { 87 IN_PROC_BROWSER_TEST_F(PreferenceServiceTest, Test) {
87 // The window should open with the new reference profile, with window 88 // The window should open with the new reference profile, with window
88 // placement values stored in the user data directory. 89 // placement values stored in the user data directory.
89 JSONFileValueDeserializer deserializer(original_pref_file_); 90 JSONFileValueDeserializer deserializer(original_pref_file_);
90 std::unique_ptr<base::Value> root = deserializer.Deserialize(NULL, NULL); 91 std::unique_ptr<base::Value> root;
92 {
93 base::ThreadRestrictions::ScopedAllowIO allow_io;
94 root = deserializer.Deserialize(NULL, NULL);
95 }
91 96
92 ASSERT_TRUE(root.get()); 97 ASSERT_TRUE(root.get());
93 ASSERT_TRUE(root->IsType(base::Value::Type::DICTIONARY)); 98 ASSERT_TRUE(root->IsType(base::Value::Type::DICTIONARY));
94 99
95 base::DictionaryValue* root_dict = 100 base::DictionaryValue* root_dict =
96 static_cast<base::DictionaryValue*>(root.get()); 101 static_cast<base::DictionaryValue*>(root.get());
97 102
98 // Retrieve the screen rect for the launched window 103 // Retrieve the screen rect for the launched window
99 gfx::Rect bounds = browser()->window()->GetRestoredBounds(); 104 gfx::Rect bounds = browser()->window()->GetRestoredBounds();
100 105
(...skipping 20 matching lines...) Expand all
121 EXPECT_EQ(right, bounds.x() + bounds.width()); 126 EXPECT_EQ(right, bounds.x() + bounds.width());
122 127
123 // Find if launched window is maximized. 128 // Find if launched window is maximized.
124 bool is_window_maximized = browser()->window()->IsMaximized(); 129 bool is_window_maximized = browser()->window()->IsMaximized();
125 bool is_maximized = false; 130 bool is_maximized = false;
126 EXPECT_TRUE(root_dict->GetBoolean(kBrowserWindowPlacement + ".maximized", 131 EXPECT_TRUE(root_dict->GetBoolean(kBrowserWindowPlacement + ".maximized",
127 &is_maximized)); 132 &is_maximized));
128 EXPECT_EQ(is_maximized, is_window_maximized); 133 EXPECT_EQ(is_maximized, is_window_maximized);
129 } 134 }
130 #endif 135 #endif
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_functional_browsertest.cc ('k') | chrome/browser/prerender/prerender_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698