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

Issue 10914109: Refactoring and tests for the highly undertested file_util::CreateOrUpdateShortcutLink() method. (Closed)

Created:
8 years, 3 months ago by gab
Modified:
8 years, 3 months ago
CC:
chromium-reviews, grt+watch_chromium.org, erikwright+watch_chromium.org, Halli, grt (UTC plus 2)
Visibility:
Public.

Description

Refactoring and tests for the highly undertested file_util::CreateOrUpdateShortcutLink() method. Simplify file_util::CreateOrUpdateShortcutLink()'s interface (use a struct to set parameters passed which allows callers to specify exactly what they want without having to pass in a bunch of NULLs for the unused parameters). The same concept will be used for ShellUtil's shortcut functions in an upcoming CL. Moved ShellUtil::VerifyChromeShortcut() to file_util::VerifyShortcut() and augmented it for every shortcut properties. This will also allow other shortcut creators (web apps, profiles, etc.) to have a broader test coverage on the shortcut they create (i.e. more testable properties available). I will leave it up to the owners of these various projects to augment their tests, this CL keeps the previously tested behavior, not more, not less. This is the 1st CL of a massive refactoring effort for shortcuts (http://goo.gl/Az889) in which ShellUtil's shortcut methods have to be refactored (http://codereview.chromium.org/10836247/ : soon to incorporate interface changes from this CL) which led me even lower to first refactor file_util's shortcut methods. BUG=132825 TEST=base_unittests --gtest_filter=FileUtilShortcutTest* installer_util_unitests --gtest_filter=ShellUtilTestWithDirAndDist* unit_tests --gtest_filter=ProfileShortcutManagerTest* Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=155869

Patch Set 1 : #

Total comments: 20

Patch Set 2 : initial nits #

Patch Set 3 : Rebase on r155144 #

Patch Set 4 : always use both LongPathName and ShortPathName when verifying paths #

Total comments: 2

Patch Set 5 : address robert's comments #

Patch Set 6 : better path matching #

Total comments: 2

Patch Set 7 : Move all Windows shortcut methods to base::win:: #

Patch Set 8 : string16 to FilePath where appropriate #

Total comments: 2

Patch Set 9 : namespace s/Win/win #

Unified diffs Side-by-side diffs Delta from patch set Stats (+907 lines, -469 lines) Patch
M base/base.gyp View 1 2 3 4 5 6 2 chunks +3 lines, -0 lines 0 comments Download
M base/base.gypi View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M base/file_util.h View 1 2 3 4 5 6 1 chunk +0 lines, -51 lines 0 comments Download
M base/file_util_unittest.cc View 1 2 3 4 5 6 1 chunk +0 lines, -69 lines 0 comments Download
M base/file_util_win.cc View 1 2 3 4 5 6 3 chunks +0 lines, -155 lines 0 comments Download
A base/test/test_shortcut_win.h View 1 2 3 4 5 6 7 8 1 chunk +38 lines, -0 lines 0 comments Download
A base/test/test_shortcut_win.cc View 1 2 3 4 5 6 7 1 chunk +142 lines, -0 lines 0 comments Download
A base/win/shortcut.h View 1 2 3 4 5 6 7 8 1 chunk +142 lines, -0 lines 0 comments Download
A base/win/shortcut.cc View 1 2 3 4 5 6 7 1 chunk +180 lines, -0 lines 0 comments Download
A base/win/shortcut_unittest.cc View 1 2 3 4 5 6 7 1 chunk +221 lines, -0 lines 0 comments Download
M base/win/win_util.h View 1 chunk +4 lines, -3 lines 0 comments Download
M base/win/win_util.cc View 1 chunk +7 lines, -3 lines 0 comments Download
M chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc View 1 2 3 4 5 6 7 14 chunks +31 lines, -25 lines 0 comments Download
M chrome/browser/shell_integration_win.cc View 1 2 3 4 5 6 7 2 chunks +6 lines, -4 lines 0 comments Download
M chrome/browser/ui/web_applications/web_app_ui.cc View 1 2 3 4 5 6 7 3 chunks +13 lines, -11 lines 0 comments Download
M chrome/browser/web_applications/web_app_win.cc View 1 2 3 4 5 6 7 7 chunks +19 lines, -18 lines 0 comments Download
M chrome/installer/setup/install.cc View 1 2 3 4 5 6 7 3 chunks +10 lines, -7 lines 0 comments Download
M chrome/installer/setup/uninstall.cc View 1 2 3 4 5 6 2 chunks +2 lines, -1 line 0 comments Download
M chrome/installer/util/shell_util.h View 1 chunk +0 lines, -10 lines 0 comments Download
M chrome/installer/util/shell_util.cc View 1 2 3 4 5 6 7 3 chunks +19 lines, -59 lines 0 comments Download
M chrome/installer/util/shell_util_unittest.cc View 1 2 3 4 5 6 7 14 chunks +61 lines, -51 lines 0 comments Download
M net/url_request/url_request_file_job.cc View 1 2 3 4 5 6 2 chunks +5 lines, -1 line 0 comments Download
M ui/base/dialogs/select_file_dialog_win.cc View 1 2 3 4 5 6 2 chunks +2 lines, -1 line 0 comments Download

Messages

Total messages: 21 (0 generated)
gab
Robert, please take a look, feel free to defer to grt if you're overwhelmed, but ...
8 years, 3 months ago (2012-09-05 22:22:13 UTC) #1
robertshield
Some preliminary nits. Overall, looks pretty good. Will think more on this tomorrow. http://codereview.chromium.org/10914109/diff/2001/base/file_util.h File ...
8 years, 3 months ago (2012-09-06 02:37:34 UTC) #2
gab
Most nits addressed, see comments below. http://codereview.chromium.org/10914109/diff/2001/base/file_util.h File base/file_util.h (right): http://codereview.chromium.org/10914109/diff/2001/base/file_util.h#newcode236 base/file_util.h:236: // Propoerties for ...
8 years, 3 months ago (2012-09-06 04:20:02 UTC) #3
robertshield
lgtm w/nits http://codereview.chromium.org/10914109/diff/2001/base/file_util_win.cc File base/file_util_win.cc (right): http://codereview.chromium.org/10914109/diff/2001/base/file_util_win.cc#newcode440 base/file_util_win.cc:440: const bool has_app_id = On 2012/09/06 04:20:02, ...
8 years, 3 months ago (2012-09-06 19:20:01 UTC) #4
gab
Done, running Win try bots again: for some reasons the tests are failing on the ...
8 years, 3 months ago (2012-09-07 04:58:05 UTC) #5
gab
Better path matching, @robertshield: PTAL.
8 years, 3 months ago (2012-09-07 15:04:38 UTC) #6
robertshield
lgtm++
8 years, 3 months ago (2012-09-07 15:46:56 UTC) #7
gab
brettw: base/* and chrome/* (except chrome/installer) OWNER approval (I can get a more specific owner ...
8 years, 3 months ago (2012-09-07 15:56:07 UTC) #8
brettw
I feel like the file_util addition is quite large for this file which is already ...
8 years, 3 months ago (2012-09-08 18:28:47 UTC) #9
gab
@brettw: Done. Patch set 7: Moved all shortcut methods to base/win/shortcut.h, made a new base/test/test_shortcut_win.h ...
8 years, 3 months ago (2012-09-10 17:35:33 UTC) #10
grt (UTC plus 2)
a teeny tiny nit http://codereview.chromium.org/10914109/diff/5013/base/win/shortcut.h File base/win/shortcut.h (right): http://codereview.chromium.org/10914109/diff/5013/base/win/shortcut.h#newcode139 base/win/shortcut.h:139: } // namespace Win nit: ...
8 years, 3 months ago (2012-09-10 17:46:59 UTC) #11
gab
Good catch, done. @brettw: back to you. http://codereview.chromium.org/10914109/diff/5013/base/win/shortcut.h File base/win/shortcut.h (right): http://codereview.chromium.org/10914109/diff/5013/base/win/shortcut.h#newcode139 base/win/shortcut.h:139: } // ...
8 years, 3 months ago (2012-09-10 17:55:38 UTC) #12
brettw
Sweet, LGTM rubberstamp, I didn't look at the logic.
8 years, 3 months ago (2012-09-10 19:09:41 UTC) #13
gab
Thanks, @asanka: net/ OWNER rubberstamp (only a small side-effect) @sky: ui/ OWNER rubberstamp (only a ...
8 years, 3 months ago (2012-09-10 19:20:29 UTC) #14
gab
[Actually adding OWNERs this time] @asanka: net/ OWNER rubberstamp (only a small side-effect) @sky: ui/ ...
8 years, 3 months ago (2012-09-10 20:49:13 UTC) #15
sky
LGTM
8 years, 3 months ago (2012-09-10 21:12:02 UTC) #16
agl
LGTM for net/
8 years, 3 months ago (2012-09-10 21:14:51 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/gab@chromium.org/10914109/2053
8 years, 3 months ago (2012-09-10 21:15:32 UTC) #18
commit-bot: I haz the power
Change committed as 155869
8 years, 3 months ago (2012-09-10 23:41:30 UTC) #19
dgrogan
I reverted 155869 in 155918. installer_util_unittests has failed on XP Tests (dbg)(1) since this landed ...
8 years, 3 months ago (2012-09-11 02:52:37 UTC) #20
dgrogan
8 years, 3 months ago (2012-09-11 02:52:37 UTC) #21
I reverted 155869 in 155918.  installer_util_unittests has failed on XP Tests
(dbg)(1) since this landed with the unhelpful:

[Running on builder: "XP Tests (dbg)(1)"]

E:\b\build\slave\XP_Tests__dbg__1_\build\src\build\Debug\installer_util_unittests.exe
--gtest_print_time
--gtest_output=xml:gtest-results\installer_util_unittests\installer_util_unittests.xml
No data was available to update the JSON results
Unable to generate JSON from XML, using log output.program finished with exit
code -1073741515
elapsedTime=2.047000

Powered by Google App Engine
This is Rietveld 408576698